diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-07 10:56:35 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-08 09:28:49 +0200 |
commit | e80ef5934e71bcc52bdcabb6d3fe1d1b100d75c4 (patch) | |
tree | bb05031efb0546694f5cefb40a87577eefb83ce4 /tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | |
parent | e5f3e7149b7e130c375c1419f1f804dfeaf578aa (diff) |
Add a property "valid" to the color value type
This gives users a more convenient way to determine if a particular
color is valid. Before you had to actually compare with an invalid
color.
Fixes: QTBUG-78325
Change-Id: Id86bc46a48aa11da3e6654d2940d758d2b0e784f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp')
-rw-r--r-- | tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index a55da25a91..3e9047cc5a 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -935,6 +935,11 @@ void tst_qqmlvaluetypes::color() QCOMPARE(qRound(object->property("hsl_s").toDouble() * 100), 74); QCOMPARE(qRound(object->property("hsl_l").toDouble() * 100), 54); + QCOMPARE(object->property("valid").userType(), QMetaType::Bool); + QVERIFY(object->property("valid").toBool()); + QCOMPARE(object->property("invalid").userType(), QMetaType::Bool); + QVERIFY(!object->property("invalid").toBool()); + QColor comparison; comparison.setRedF(0.2); comparison.setGreenF(0.88); |