scenegraph: un-blacklist the render autotest on Android

The tst_scenegraph render tests were disabled for Android because they
were failing in CI. This appears to mostly be related to Android devices
having non-integer scaling factors, which causes issues with the render
test as it tests pixel color values derived from QML coordinates.

Most of these issues can be resolved by having the color sample function
round it's floating point values instead of implicitly flooring them
when they are converted to int values.

The render_bug37422 test was failing because the .qsb file was not
handled correctly as test data, so that was converted to use the new
syntax that builds the .qsb file at build time.

The render_OutOfFloatRange test still remains problematic by design on
system with non-integer scaling factors so is disabled when that is the
case.

Fixes: QTBUG-102589
Pick-to: 6.5
Change-Id: I3cae5c9700ef0d5acf2cce46518576de99717c99
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Andy Nichols 2023-03-14 13:59:03 +01:00 committed by Andy Nichols
parent af4cd4763a
commit 4db97d57a9
5 changed files with 18 additions and 5 deletions

View File

@ -1,3 +0,0 @@
# QTBUG-102589
[render]
android

View File

@ -26,6 +26,16 @@ qt_internal_add_test(tst_scenegraph
TESTDATA ${test_data} TESTDATA ${test_data}
) )
qt_internal_add_shaders(tst_scenegraph "shaders"
BATCHABLE
PRECOMPILE
OPTIMIZED
PREFIX
"/"
FILES
"data/render_bug37422.frag"
)
#### Keys ignored in scope 1:.:.:scenegraph.pro:<TRUE>: #### Keys ignored in scope 1:.:.:scenegraph.pro:<TRUE>:
# OTHER_FILES = "data/render_OutOfFloatRange.qml" "data/simple.qml" "data/render_ImageFiltering.qml" # OTHER_FILES = "data/render_OutOfFloatRange.qml" "data/simple.qml" "data/render_ImageFiltering.qml"

View File

@ -48,7 +48,7 @@ RenderTestBase
y: 10 y: 10
fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL
? "varying highp vec2 qt_TexCoord0; void main() { gl_FragColor = vec4(1, 0, 0, 1); }" ? "varying highp vec2 qt_TexCoord0; void main() { gl_FragColor = vec4(1, 0, 0, 1); }"
: "file:data/render_bug37422.frag.qsb" : "qrc:/data/render_bug37422.frag.qsb"
Rectangle { Rectangle {
width: 5 width: 5

View File

@ -289,7 +289,9 @@ struct Sample {
} }
bool check(const QImage &image, qreal scale) { bool check(const QImage &image, qreal scale) {
QColor color(image.pixel(x * scale, y * scale)); const int scaledX = qRound(x * scale);
const int scaledY = qRound(y * scale);
const QColor color(image.pixel(scaledX, scaledY));
return qAbs(color.redF() - r) <= tolerance return qAbs(color.redF() - r) <= tolerance
&& qAbs(color.greenF() - g) <= tolerance && qAbs(color.greenF() - g) <= tolerance
&& qAbs(color.blueF() - b) <= tolerance; && qAbs(color.blueF() - b) <= tolerance;
@ -430,6 +432,10 @@ void tst_SceneGraph::render()
// ideal world. // ideal world.
// Just keep this in mind when writing tests. // Just keep this in mind when writing tests.
qreal scale = view.devicePixelRatio(); qreal scale = view.devicePixelRatio();
const bool isIntegerScale = qFuzzyIsNull(qreal(qFloor(scale)) - scale);
if (file == "render_OutOfFloatRange.qml" && !isIntegerScale)
QSKIP("render_OutOfFloatRange doesn't work with non-integer scaling factors");
// Grab the window and check all our base stage samples // Grab the window and check all our base stage samples
QImage content = view.grabWindow(); QImage content = view.grabWindow();