diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-04-19 17:30:59 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-23 02:05:22 +0200 |
commit | 6d2ed5d0b645f5af383a123e869d061b235b4b85 (patch) | |
tree | 72034ba88aff417ece70cc3d57e73c50b4a900bb /tests/auto/qml/qqmlcomponent/data/NestedDirectories | |
parent | b86b3bb0f44cdbdb21413b967be67d37b7fefa64 (diff) |
Add some component path canonicalization tests
Previously, no unit test existed to ensure that url canonicalization
worked correctly, which could result in two import statements using
relative paths to the same actual component triggering two separate
types being generated.
This commit adds a unit test with various relative-addressing and both
static and dynamic imports, to enforce type-consistency.
Change-Id: I7772e3c531069322d5fa44063cbf57a758ed3710
Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlcomponent/data/NestedDirectories')
6 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml new file mode 100644 index 0000000000..b966cb30d1 --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml @@ -0,0 +1,23 @@ +import QtQuick 2.0 +import "NestedDirOne" +import "NestedDirOne/NestedDirTwo/../../../SpecificComponent" + +// NestedDirectoriesTopLevelComponent + +Item { + id: ndtlcId + property NDComponentOne a: NDComponentOne { } + property NDComponentOne b: NDComponentOne { } + property SpecificComponent scOne: SpecificComponent { } + property SpecificComponent scTwo + + function assignScTwo() { + // It seems that doing this in onCompleted doesn't work, + // since that handler will be evaluated after the + // componentUrlCanonicalization.3.qml onCompleted handler. + // So, call this function manually.... + var c1 = Qt.createComponent("NestedDirOne/NestedDirTwo/NDComponentTwo.qml"); + var o1 = c1.createObject(ndtlcId); + scTwo = o1.sc; + } +} diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml new file mode 100644 index 0000000000..2cfcd47737 --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 +import "../../SpecificComponent" +import "NestedDirTwo" + +Item { + property int a + property NDComponentTwo b: NDComponentTwo { } + property SpecificComponent sc: SpecificComponent { } +} diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml new file mode 100644 index 0000000000..d2df36adc4 --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import "../../../SpecificComponent" + +Item { + property SpecificComponent sc: SpecificComponent { } +} diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir new file mode 100644 index 0000000000..11c6fdd311 --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir @@ -0,0 +1 @@ +NDComponentTwo 1.0 NDComponentTwo.qml diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir new file mode 100644 index 0000000000..5ef4d13c15 --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir @@ -0,0 +1 @@ +NDComponentOne 1.0 NDComponentOne.qml diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir new file mode 100644 index 0000000000..adb0fdcbae --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir @@ -0,0 +1 @@ +NDTLC 1.0 NDTLC.qml |