From 6a02fb09af8dce6ca533e816d2223e070b30f294 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 16 May 2017 19:08:28 +0200 Subject: QQmlIRBuilder: Only query type name cache for type names The behavior here was always incorrect: type names must start with an uppercase letter, so querying the type name cache with a lowercase string is wrong. However, this was turned into a larger problem by making more extensive use of QQmlTypeNameCache in e74a1d0b342f2c95dc3a543c8c9ec07fd52d8fe0, as it contained a lot of new types (including composite types, which previously were only in the cache if they were singletons). Task-number: QTBUG-60547 Change-Id: I40be2d535e99d3e1af250d995d7149ecbe2965d7 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp') diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 72179d243f..7b9a43dc38 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -337,6 +337,7 @@ private slots: void instanceof(); void freeze_empty_object(); void singleBlockLoops(); + void qtbug_60547(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -8250,6 +8251,16 @@ void tst_qqmlecmascript::singleBlockLoops() QVERIFY(!component.isError()); } +// 'counter' was incorrectly resolved as a type rather than a variable. +// This fix ensures it looks up the right thing. +void tst_qqmlecmascript::qtbug_60547() +{ + QQmlComponent component(&engine, testFileUrl("qtbug60547/main.qml")); + QScopedPointer object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); + QCOMPARE(object->property("counter"), QVariant(int(1))); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" -- cgit v1.2.3