summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp54
1 files changed, 32 insertions, 22 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index c39e6f7..ff03005 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -48,12 +48,16 @@
#include <private/qdeclarativeproperty_p.h>
#include <private/qdeclarativemetatype_p.h>
+#include <private/qdeclarativeglobal_p.h>
#include "testtypes.h"
#include "../../../shared/util.h"
#include "testhttpserver.h"
+DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES)
+
+
/*
This test case covers QML language issues. This covers everything that does not
involve evaluating ECMAScript expressions and bindings.
@@ -1257,14 +1261,14 @@ void tst_qdeclarativelanguage::importsBuiltin_data()
<< "import com.nokia.Test 1.11\n"
"import com.nokia.Test 1.12\n"
"Test {}"
- << "TestType2"
- << "";
+ << (!qmlCheckTypes()?"TestType2":"")
+ << (!qmlCheckTypes()?"":"Test is ambiguous. Found in com/nokia/Test in version 1.12 and 1.11");
QTest::newRow("multiversion 2")
<< "import com.nokia.Test 1.11\n"
"import com.nokia.Test 1.12\n"
"OldTest {}"
- << "TestType"
- << "";
+ << (!qmlCheckTypes()?"TestType":"")
+ << (!qmlCheckTypes()?"":"OldTest is ambiguous. Found in com/nokia/Test in version 1.12 and 1.11");
QTest::newRow("qualified multiversion 3")
<< "import com.nokia.Test 1.0 as T0\n"
"import com.nokia.Test 1.8 as T8\n"
@@ -1312,12 +1316,12 @@ void tst_qdeclarativelanguage::importsLocal_data()
QTest::newRow("local import QTBUG-7721 A")
<< "subdir.Test {}" // no longer allowed (QTBUG-7721)
<< ""
- << "subdir.Test is not a type";
+ << "subdir.Test - subdir is not a namespace";
QTest::newRow("local import QTBUG-7721 B")
<< "import \"subdir\" as X\n"
"X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721)
<< ""
- << "X.subsubdir.SubTest is not a type";
+ << "X.subsubdir.SubTest - nested namespaces not allowed";
QTest::newRow("local import as")
<< "import \"subdir\" as T\n"
"T.Test {}"
@@ -1332,8 +1336,8 @@ void tst_qdeclarativelanguage::importsLocal_data()
<< "import \"subdir\"\n"
"import com.nokia.Test 1.0\n"
"Test {}"
- << "TestType"
- << "";
+ << (!qmlCheckTypes()?"TestType":"")
+ << (!qmlCheckTypes()?"":"Test is ambiguous. Found in com/nokia/Test and in subdir");
}
void tst_qdeclarativelanguage::importsLocal()
@@ -1478,46 +1482,52 @@ void tst_qdeclarativelanguage::importsOrder_data()
QTest::addColumn<QString>("type");
QTest::addColumn<QString>("error");
+ QTest::newRow("double import") <<
+ "import com.nokia.installedtest 1.4\n"
+ "import com.nokia.installedtest 1.4\n"
+ "InstalledTest {}"
+ << (!qmlCheckTypes()?"QDeclarativeText":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.4 and 1.4");
QTest::newRow("installed import overrides 1") <<
"import com.nokia.installedtest 1.0\n"
"import com.nokia.installedtest 1.4\n"
"InstalledTest {}"
- << "QDeclarativeText"
- << "";
+ << (!qmlCheckTypes()?"QDeclarativeText":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.4 and 1.0");
QTest::newRow("installed import overrides 2") <<
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"InstalledTest {}"
- << "QDeclarativeRectangle"
- << "";
+ << (!qmlCheckTypes()?"QDeclarativeRectangle":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.0 and 1.4");
QTest::newRow("installed import re-overrides 1") <<
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"import com.nokia.installedtest 1.4\n"
"InstalledTest {}"
- << "QDeclarativeText"
- << "";
+ << (!qmlCheckTypes()?"QDeclarativeText":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.4 and 1.0");
QTest::newRow("installed import re-overrides 2") <<
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"InstalledTest {}"
- << "QDeclarativeRectangle"
- << "";
+ << (!qmlCheckTypes()?"QDeclarativeRectangle":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/com/nokia/installedtest in version 1.0 and 1.4");
QTest::newRow("installed import versus builtin 1") <<
"import com.nokia.installedtest 1.5\n"
"import Qt 4.7\n"
"Rectangle {}"
- << "QDeclarativeRectangle"
- << "";
+ << (!qmlCheckTypes()?"QDeclarativeRectangle":"")
+ << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in Qt and in lib/com/nokia/installedtest");
QTest::newRow("installed import versus builtin 2") <<
"import Qt 4.7\n"
"import com.nokia.installedtest 1.5\n"
"Rectangle {}"
- << "QDeclarativeText"
- << "";
+ << (!qmlCheckTypes()?"QDeclarativeText":"")
+ << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in lib/com/nokia/installedtest and in Qt");
QTest::newRow("namespaces cannot be overridden by types 1") <<
"import Qt 4.7 as Rectangle\n"
"import com.nokia.installedtest 1.5\n"
@@ -1537,8 +1547,8 @@ void tst_qdeclarativelanguage::importsOrder_data()
QTest::newRow("local last 2") <<
"import com.nokia.installedtest 1.0\n"
"LocalLast {}"
- << "QDeclarativeRectangle"
- << ""; // i.e. from com.nokia.installedtest, not data/LocalLast.qml
+ << (!qmlCheckTypes()?"QDeclarativeRectangle":"")// i.e. from com.nokia.installedtest, not data/LocalLast.qml
+ << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/com/nokia/installedtest and in local directory");
}
void tst_qdeclarativelanguage::importsOrder()