aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmllanguage/data/signatureEnforced.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp12
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/signatureEnforced.qml b/tests/auto/qml/qqmllanguage/data/signatureEnforced.qml
index e2ddd75b55..ec00d5d2b3 100644
--- a/tests/auto/qml/qqmllanguage/data/signatureEnforced.qml
+++ b/tests/auto/qml/qqmllanguage/data/signatureEnforced.qml
@@ -8,7 +8,7 @@ QtObject {
property withLength withLength: 5
function a(r: rect) {
- r.x = 77 // does not write back
+ r.x = 77 // does write back, but this is an evil thing to do.
}
function b(s: string) : int {
@@ -28,8 +28,11 @@ QtObject {
property int n: c(99) // creates a withLength
property int o: rect.y
+ function bad(b: int) { return b }
+
Component.onCompleted: {
a(rect)
d(rect)
+ bad(15)
}
}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 9af21af82c..2277e91a47 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -7735,12 +7735,20 @@ void tst_qqmllanguage::functionSignatureEnforcement()
QCOMPARE(ignored->property("m").toInt(), 77);
QCOMPARE(ignored->property("n").toInt(), 67);
- QQmlComponent c2(&engine, testFileUrl("signatureEnforced.qml"));
+ const QUrl url2 = testFileUrl("signatureEnforced.qml");
+ QQmlComponent c2(&engine, url2);
QVERIFY2(c2.isReady(), qPrintable(c2.errorString()));
+ QTest::ignoreMessage(
+ QtCriticalMsg,
+ qPrintable(url2.toString() + u":36: 15 should be coerced to void because the function "
+ "called is insufficiently annotated. The original value "
+ "is retained. "
+ "This will change in a future version of Qt."_s));
+
QScopedPointer<QObject> enforced(c2.create());
QCOMPARE(enforced->property("l").toInt(), 2); // strlen("no")
- QCOMPARE(enforced->property("m").toInt(), 12);
+ QCOMPARE(enforced->property("m").toInt(), 77);
QCOMPARE(enforced->property("n").toInt(), 99);
QCOMPARE(enforced->property("o").toInt(), 77);
}