-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
Code
import QtQuick import QtTest TestCase { id: testCase //visible: true // <-- One possible solution Rectangle { id: redSquare color: "red" width: 100 height: 100 } function test_grabAndCheckColor() { const img = testCase.grabImage(redSquare) compare(img.pixel(0, 0), Qt.color("red")); } }
Outcomes
FAIL! : example::test_grabAndCheckColor() Compared values are not the same Actual (): #ffffff Expected (): #ff0000
Here, grabImage() fails because redSquare is not visible (because testCase is not visible). This can be quite unintuitive.
Suggestion
We should produce a runtime warning if TestCase.grabImage() is called on an invisible Item.
- relates to
-
QTBUG-141192 Improve TestCase documentation about testing visual componens
-
- Reported
-