aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmldirparser
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2014-08-28 16:51:00 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2014-08-28 16:52:02 +0200
commite64b6245a91a9d2bd269452c772c7c6eea784b39 (patch)
tree7991c4cbfc7a0b702fef6b8a3e9cb362a2b9ce8b /tests/auto/qml/qqmldirparser
parent26fb6a0915ec64d30eaa78e781e7f18468bc2ed7 (diff)
Add new property "designersupported" to qmldir
This patch adds a property called "designersupported" to qmldir. This allows the Qt Quick Designer to only load plugins that have the line ""designersupported"" in their qmldir file. So the designer can load sub components without risking to load plugins that have never been tested in the designer and that might crash. The check for "designersupported"" is activated by using QQmlImports::setDesignerSupportRequired(). Change-Id: I4bf07cc163faa47996eacb1365a7961c51c51060 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmldirparser')
-rw-r--r--tests/auto/qml/qqmldirparser/data/designersupported-no/qmldir2
-rw-r--r--tests/auto/qml/qqmldirparser/data/designersupported-yes/qmldir2
-rw-r--r--tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp70
3 files changed, 57 insertions, 17 deletions
diff --git a/tests/auto/qml/qqmldirparser/data/designersupported-no/qmldir b/tests/auto/qml/qqmldirparser/data/designersupported-no/qmldir
new file mode 100644
index 0000000000..3b660e8c36
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/designersupported-no/qmldir
@@ -0,0 +1,2 @@
+plugin foo
+
diff --git a/tests/auto/qml/qqmldirparser/data/designersupported-yes/qmldir b/tests/auto/qml/qqmldirparser/data/designersupported-yes/qmldir
new file mode 100644
index 0000000000..2e86aca298
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/designersupported-yes/qmldir
@@ -0,0 +1,2 @@
+plugin foo
+designersupported
diff --git a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
index 0984da2e1e..017a92b590 100644
--- a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
+++ b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
@@ -125,118 +125,135 @@ void tst_qqmldirparser::parse_data()
QTest::addColumn<QStringList>("plugins");
QTest::addColumn<QStringList>("components");
QTest::addColumn<QStringList>("scripts");
+ QTest::addColumn<bool>("designerSupported");
QTest::newRow("empty")
<< "empty/qmldir"
<< QStringList()
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("no-content")
<< "no-content/qmldir"
<< QStringList()
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("one-section")
<< "one-section/qmldir"
<< (QStringList() << "qmldir:1: a component declaration requires two or three arguments, but 1 were provided")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("four-sections")
<< "four-sections/qmldir"
<< (QStringList() << "qmldir:1: a component declaration requires two or three arguments, but 4 were provided")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("incomplete-module")
<< "incomplete-module/qmldir"
<< (QStringList() << "qmldir:1: module identifier directive requires one argument, but 0 were provided")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("excessive-module")
<< "excessive-module/qmldir"
<< (QStringList() << "qmldir:1: module identifier directive requires one argument, but 2 were provided")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("repeated-module")
<< "repeated-module/qmldir"
<< (QStringList() << "qmldir:2: only one module identifier directive may be defined in a qmldir file")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("non-first-module")
<< "non-first-module/qmldir"
<< (QStringList() << "qmldir:2: module identifier directive must be the first directive in a qmldir file")
<< (QStringList() << "foo|")
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("incomplete-plugin")
<< "incomplete-plugin/qmldir"
<< (QStringList() << "qmldir:1: plugin directive requires one or two arguments, but 0 were provided")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("excessive-plugin")
<< "excessive-plugin/qmldir"
<< (QStringList() << "qmldir:1: plugin directive requires one or two arguments, but 3 were provided")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("name-plugin")
<< "name-plugin/qmldir"
<< QStringList()
<< (QStringList() << "foo|")
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("name-path-plugin")
<< "name-path-plugin/qmldir"
<< QStringList()
<< (QStringList() << "foo|bar")
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("unversioned-component")
<< "unversioned-component/qmldir"
<< QStringList()
<< QStringList()
<< (QStringList() << "foo|bar|-1|-1|false")
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("invalid-versioned-component")
<< "invalid-versioned-component/qmldir"
<< (QStringList() << "qmldir:1: expected '.'")
<< QStringList()
<< QStringList()
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("versioned-component")
<< "versioned-component/qmldir"
<< QStringList()
<< QStringList()
<< (QStringList() << "foo|bar|33|66|false")
- << QStringList();
+ << QStringList()
+ << false;
QTest::newRow("versioned-script")
<< "versioned-script/qmldir"
<< QStringList()
<< QStringList()
<< QStringList()
- << (QStringList() << "foo|bar.js|33|66");
+ << (QStringList() << "foo|bar.js|33|66")
+ << false;
QTest::newRow("multiple")
<< "multiple/qmldir"
@@ -245,7 +262,24 @@ void tst_qqmldirparser::parse_data()
<< (QStringList() << "ComponentA|componenta-1_0.qml|1|0|false"
<< "ComponentA|componenta-1_5.qml|1|5|false"
<< "ComponentB|componentb-1_5.qml|1|5|false")
- << (QStringList() << "ScriptA|scripta-1_0.js|1|0");
+ << (QStringList() << "ScriptA|scripta-1_0.js|1|0")
+ << false;
+
+ QTest::newRow("designersupported-yes")
+ << "designersupported-yes/qmldir"
+ << QStringList()
+ << (QStringList() << "foo|")
+ << QStringList()
+ << QStringList()
+ << true;
+
+ QTest::newRow("designersupported-no")
+ << "designersupported-no/qmldir"
+ << QStringList()
+ << (QStringList() << "foo|")
+ << QStringList()
+ << QStringList()
+ << false;
}
void tst_qqmldirparser::parse()
@@ -255,6 +289,7 @@ void tst_qqmldirparser::parse()
QFETCH(QStringList, plugins);
QFETCH(QStringList, components);
QFETCH(QStringList, scripts);
+ QFETCH(bool, designerSupported);
QFile f(testFile(file));
f.open(QIODevice::ReadOnly);
@@ -272,6 +307,7 @@ void tst_qqmldirparser::parse()
QCOMPARE(toStringList(p.plugins()), plugins);
QCOMPARE(toStringList(p.components()), components);
QCOMPARE(toStringList(p.scripts()), scripts);
+ QCOMPARE(p.designerSupported(), designerSupported);
}
QTEST_MAIN(tst_qqmldirparser)