diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-09 17:10:19 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-09 20:41:11 +0000 |
commit | 399a4403b45026df1994f26324f6360b14977956 (patch) | |
tree | 251250c7ccee2e90227e96dee0e5508d9223e9c1 /tests/auto | |
parent | 8a02b7560a4b8fc78e95227c3a664fdfeeb2d18a (diff) |
Use QtQuick.Templates
Change-Id: I3d1822457efd740e7c9d91747e978d787c0dd4b8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_control.qml | 15 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_scrollbar.qml | 5 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_scrollindicator.qml | 5 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 3 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_stackview.qml | 169 |
5 files changed, 101 insertions, 96 deletions
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml index 003a74a7..82c945dc 100644 --- a/tests/auto/controls/data/tst_control.qml +++ b/tests/auto/controls/data/tst_control.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtTest 1.0 import QtQuick.Controls 2.0 +import QtQuick.Templates 2.0 as T TestCase { id: testCase @@ -52,7 +53,7 @@ TestCase { Component { id: component - Control { } + T.Control { } } SignalSpy { @@ -267,7 +268,7 @@ TestCase { Component { id: component2 - Control { + T.Control { id: item2 objectName: "item2" property alias item2_2: _item2_2; @@ -275,10 +276,10 @@ TestCase { property alias item2_4: _item2_4; property alias item2_5: _item2_5; font.family: "Arial" - Control { + T.Control { id: _item2_2 objectName: "_item2_2" - Control { + T.Control { id: _item2_3 objectName: "_item2_3" } @@ -391,7 +392,7 @@ TestCase { Component { id: component3 - Control { + T.Control { id: item3 objectName: "item3" property alias item3_2: _item3_2; @@ -404,13 +405,13 @@ TestCase { Item { id: _item3_2 objectName: "_item3_2" - Control { + T.Control { id: _item3_3 objectName: "_item3_3" Item { id: _item3_6 objectName: "_item3_6" - Control { + T.Control { id: _item3_7 objectName: "_item3_7" } diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml index 6e1a328c..54e21690 100644 --- a/tests/auto/controls/data/tst_scrollbar.qml +++ b/tests/auto/controls/data/tst_scrollbar.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtTest 1.0 import QtQuick.Controls 2.0 +import QtQuick.Templates 2.0 as T TestCase { id: testCase @@ -94,7 +95,7 @@ TestCase { compare(vertical.active, false) compare(vertical.orientation, Qt.Vertical) - container.AbstractScrollBar.vertical = vertical + container.T.ScrollBar.vertical = vertical compare(vertical.parent, container) compare(vertical.orientation, Qt.Vertical) compare(vertical.size, container.visibleArea.heightRatio) @@ -107,7 +108,7 @@ TestCase { compare(horizontal.active, false) compare(horizontal.orientation, Qt.Vertical) - container.AbstractScrollBar.horizontal = horizontal + container.T.ScrollBar.horizontal = horizontal compare(horizontal.parent, container) compare(horizontal.orientation, Qt.Horizontal) compare(horizontal.size, container.visibleArea.widthRatio) diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml index 77d162b6..094f8c6e 100644 --- a/tests/auto/controls/data/tst_scrollindicator.qml +++ b/tests/auto/controls/data/tst_scrollindicator.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtTest 1.0 import QtQuick.Controls 2.0 +import QtQuick.Templates 2.0 as T TestCase { id: testCase @@ -79,7 +80,7 @@ TestCase { compare(vertical.active, false) compare(vertical.orientation, Qt.Vertical) - container.AbstractScrollIndicator.vertical = vertical + container.T.ScrollIndicator.vertical = vertical compare(vertical.parent, container) compare(vertical.orientation, Qt.Vertical) compare(vertical.size, container.visibleArea.heightRatio) @@ -92,7 +93,7 @@ TestCase { compare(horizontal.active, false) compare(horizontal.orientation, Qt.Vertical) - container.AbstractScrollIndicator.horizontal = horizontal + container.T.ScrollIndicator.horizontal = horizontal compare(horizontal.parent, container) compare(horizontal.orientation, Qt.Horizontal) compare(horizontal.size, container.visibleArea.widthRatio) diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index e985103f..64fa457b 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtTest 1.0 import QtQuick.Controls 2.0 +import QtQuick.Templates 2.0 as T TestCase { id: testCase @@ -75,7 +76,7 @@ TestCase { verify(control) compare(control.stepSize, 0) - compare(control.snapMode, AbstractSlider.NoSnap) + compare(control.snapMode, T.Slider.NoSnap) compare(control.orientation, Qt.Horizontal) control.destroy() diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml index 1e9bb92b..e9b73768 100644 --- a/tests/auto/controls/data/tst_stackview.qml +++ b/tests/auto/controls/data/tst_stackview.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtTest 1.0 import QtQuick.Controls 2.0 +import QtQuick.Templates 2.0 as T TestCase { id: testCase @@ -82,7 +83,7 @@ TestCase { compare(control.currentItem, item) control.push(component) verify(control.currentItem !== item) - control.pop(AbstractStackView.Immediate) + control.pop(T.StackView.Immediate) compare(control.currentItem, item) control.destroy() } @@ -107,23 +108,23 @@ TestCase { verify(control) var item1 = component.createObject(control) - compare(item1.AbstractStackView.status, AbstractStackView.Inactive) + compare(item1.T.StackView.status, T.StackView.Inactive) control.push(item1) - compare(item1.AbstractStackView.status, AbstractStackView.Active) + compare(item1.T.StackView.status, T.StackView.Active) var item2 = component.createObject(control) - compare(item2.AbstractStackView.status, AbstractStackView.Inactive) + compare(item2.T.StackView.status, T.StackView.Inactive) control.push(item2) - compare(item2.AbstractStackView.status, AbstractStackView.Activating) - compare(item1.AbstractStackView.status, AbstractStackView.Deactivating) - tryCompare(item2.AbstractStackView, "status", AbstractStackView.Active) - tryCompare(item1.AbstractStackView, "status", AbstractStackView.Inactive) + compare(item2.T.StackView.status, T.StackView.Activating) + compare(item1.T.StackView.status, T.StackView.Deactivating) + tryCompare(item2.T.StackView, "status", T.StackView.Active) + tryCompare(item1.T.StackView, "status", T.StackView.Inactive) control.pop() - compare(item2.AbstractStackView.status, AbstractStackView.Deactivating) - compare(item1.AbstractStackView.status, AbstractStackView.Activating) - tryCompare(item2.AbstractStackView, "status", AbstractStackView.Inactive) - tryCompare(item1.AbstractStackView, "status", AbstractStackView.Active) + compare(item2.T.StackView.status, T.StackView.Deactivating) + compare(item1.T.StackView.status, T.StackView.Activating) + tryCompare(item2.T.StackView, "status", T.StackView.Inactive) + tryCompare(item1.T.StackView, "status", T.StackView.Active) control.destroy() } @@ -133,19 +134,19 @@ TestCase { verify(control) var item1 = component.createObject(control) - compare(item1.AbstractStackView.index, -1) - control.push(item1, AbstractStackView.Immediate) - compare(item1.AbstractStackView.index, 0) + compare(item1.T.StackView.index, -1) + control.push(item1, T.StackView.Immediate) + compare(item1.T.StackView.index, 0) var item2 = component.createObject(control) - compare(item2.AbstractStackView.index, -1) - control.push(item2, AbstractStackView.Immediate) - compare(item2.AbstractStackView.index, 1) - compare(item1.AbstractStackView.index, 0) + compare(item2.T.StackView.index, -1) + control.push(item2, T.StackView.Immediate) + compare(item2.T.StackView.index, 1) + compare(item1.T.StackView.index, 0) - control.pop(AbstractStackView.Immediate) - compare(item2.AbstractStackView.index, -1) - compare(item1.AbstractStackView.index, 0) + control.pop(T.StackView.Immediate) + compare(item2.T.StackView.index, -1) + compare(item1.T.StackView.index, 0) control.destroy() } @@ -155,19 +156,19 @@ TestCase { verify(control) var item1 = component.createObject(control) - compare(item1.AbstractStackView.view, null) - control.push(item1, AbstractStackView.Immediate) - compare(item1.AbstractStackView.view, control) + compare(item1.T.StackView.view, null) + control.push(item1, T.StackView.Immediate) + compare(item1.T.StackView.view, control) var item2 = component.createObject(control) - compare(item2.AbstractStackView.view, null) - control.push(item2, AbstractStackView.Immediate) - compare(item2.AbstractStackView.view, control) - compare(item1.AbstractStackView.view, control) + compare(item2.T.StackView.view, null) + control.push(item2, T.StackView.Immediate) + compare(item2.T.StackView.view, control) + compare(item1.T.StackView.view, control) - control.pop(AbstractStackView.Immediate) - compare(item2.AbstractStackView.view, null) - compare(item1.AbstractStackView.view, control) + control.pop(T.StackView.Immediate) + compare(item2.T.StackView.view, null) + compare(item1.T.StackView.view, control) control.destroy() } @@ -176,17 +177,17 @@ TestCase { var control = stackView.createObject(testCase) verify(control) compare(control.depth, 0) - control.push(item, AbstractStackView.Immediate) + control.push(item, T.StackView.Immediate) compare(control.depth, 1) - control.push(item, AbstractStackView.Immediate) + control.push(item, T.StackView.Immediate) compare(control.depth, 2) - control.pop(AbstractStackView.Immediate) + control.pop(T.StackView.Immediate) compare(control.depth, 1) - control.push(component, AbstractStackView.Immediate) + control.push(component, T.StackView.Immediate) compare(control.depth, 2) - control.pop(AbstractStackView.Immediate) + control.pop(T.StackView.Immediate) compare(control.depth, 1) - control.pop(AbstractStackView.Immediate) // ignored + control.pop(T.StackView.Immediate) // ignored compare(control.depth, 1) control.clear() compare(control.depth, 0) @@ -212,12 +213,12 @@ TestCase { control.forceActiveFocus() verify(control.activeFocus) - control.push(textField, AbstractStackView.Immediate) + control.push(textField, T.StackView.Immediate) compare(control.currentItem, textField) textField.forceActiveFocus() verify(textField.activeFocus) - control.pop(AbstractStackView.Immediate) + control.pop(T.StackView.Immediate) compare(control.currentItem, item) verify(control.activeFocus) verify(!textField.activeFocus) @@ -233,9 +234,9 @@ TestCase { var item2 = component.createObject(control, {objectName: "2"}) var item3 = component.createObject(control, {objectName: "3"}) - control.push(item1, AbstractStackView.Immediate) - control.push(item2, AbstractStackView.Immediate) - control.push(item3, AbstractStackView.Immediate) + control.push(item1, T.StackView.Immediate) + control.push(item2, T.StackView.Immediate) + control.push(item3, T.StackView.Immediate) compare(control.find(function(item, index) { return index === 0 }), item1) compare(control.find(function(item) { return item.objectName === "1" }), item1) @@ -256,15 +257,15 @@ TestCase { var control = stackView.createObject(testCase) verify(control) - control.push([item, component, component], AbstractStackView.Immediate) + control.push([item, component, component], T.StackView.Immediate) - verify(control.get(0, AbstractStackView.DontLoad)) - compare(control.get(0, AbstractStackView.ForceLoad), item) + verify(control.get(0, T.StackView.DontLoad)) + compare(control.get(0, T.StackView.ForceLoad), item) - verify(!control.get(1, AbstractStackView.DontLoad)) + verify(!control.get(1, T.StackView.DontLoad)) - verify(control.get(2, AbstractStackView.DontLoad)) - verify(control.get(2, AbstractStackView.ForceLoad)) + verify(control.get(2, T.StackView.DontLoad)) + verify(control.get(2, T.StackView.ForceLoad)) control.destroy() } @@ -274,47 +275,47 @@ TestCase { verify(control) // missing arguments - ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: push: missing arguments") + ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: push: missing arguments") compare(control.push(), null) // nothing to push - ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: push: nothing to push") - compare(control.push(AbstractStackView.Immediate), null) + ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: push: nothing to push") + compare(control.push(T.StackView.Immediate), null) // push(item) var item1 = component.createObject(control, {objectName:"1"}) - compare(control.push(item1, AbstractStackView.Immediate), item1) + compare(control.push(item1, T.StackView.Immediate), item1) compare(control.depth, 1) compare(control.currentItem, item1) // push([item]) var item2 = component.createObject(control, {objectName:"2"}) - compare(control.push([item2], AbstractStackView.Immediate), item2) + compare(control.push([item2], T.StackView.Immediate), item2) compare(control.depth, 2) compare(control.currentItem, item2) // push(item, {properties}) var item3 = component.createObject(control) - compare(control.push(item3, {objectName:"3"}, AbstractStackView.Immediate), item3) + compare(control.push(item3, {objectName:"3"}, T.StackView.Immediate), item3) compare(item3.objectName, "3") compare(control.depth, 3) compare(control.currentItem, item3) // push([item, {properties}]) var item4 = component.createObject(control) - compare(control.push([item4, {objectName:"4"}], AbstractStackView.Immediate), item4) + compare(control.push([item4, {objectName:"4"}], T.StackView.Immediate), item4) compare(item4.objectName, "4") compare(control.depth, 4) compare(control.currentItem, item4) // push(component, {properties}) - var item5 = control.push(component, {objectName:"5"}, AbstractStackView.Immediate) + var item5 = control.push(component, {objectName:"5"}, T.StackView.Immediate) compare(item5.objectName, "5") compare(control.depth, 5) compare(control.currentItem, item5) // push([component, {properties}]) - var item6 = control.push([component, {objectName:"6"}], AbstractStackView.Immediate) + var item6 = control.push([component, {objectName:"6"}], T.StackView.Immediate) compare(item6.objectName, "6") compare(control.depth, 6) compare(control.currentItem, item6) @@ -330,34 +331,34 @@ TestCase { for (var i = 0; i < 7; ++i) items.push(component.createObject(control, {objectName:i})) - control.push(items, AbstractStackView.Immediate) + control.push(items, T.StackView.Immediate) - ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: pop: too many arguments") + ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: pop: too many arguments") compare(control.pop(1, 2, 3), null) // pop the top most item - compare(control.pop(AbstractStackView.Immediate), items[6]) + compare(control.pop(T.StackView.Immediate), items[6]) compare(control.depth, 6) compare(control.currentItem, items[5]) // pop down to (but not including) the Nth item - compare(control.pop(items[3], AbstractStackView.Immediate), items[5]) + compare(control.pop(items[3], T.StackView.Immediate), items[5]) compare(control.depth, 4) compare(control.currentItem, items[3]) // pop the top most item - compare(control.pop(undefined, AbstractStackView.Immediate), items[3]) + compare(control.pop(undefined, T.StackView.Immediate), items[3]) compare(control.depth, 3) compare(control.currentItem, items[2]) // don't pop non-existent item - ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: pop: unknown argument: " + testCase) - compare(control.pop(testCase, AbstractStackView.Immediate), null) + ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: pop: unknown argument: " + testCase) + compare(control.pop(testCase, T.StackView.Immediate), null) compare(control.depth, 3) compare(control.currentItem, items[2]) // pop all items down to (but not including) the 1st item - control.pop(null, AbstractStackView.Immediate) + control.pop(null, T.StackView.Immediate) compare(control.depth, 1) compare(control.currentItem, items[0]) @@ -369,47 +370,47 @@ TestCase { verify(control) // missing arguments - ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: replace: missing arguments") + ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: replace: missing arguments") compare(control.replace(), null) // nothing to push - ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: replace: nothing to push") - compare(control.replace(AbstractStackView.Immediate), null) + ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: replace: nothing to push") + compare(control.replace(T.StackView.Immediate), null) // replace(item) var item1 = component.createObject(control, {objectName:"1"}) - compare(control.replace(item1, AbstractStackView.Immediate), item1) + compare(control.replace(item1, T.StackView.Immediate), item1) compare(control.depth, 1) compare(control.currentItem, item1) // replace([item]) var item2 = component.createObject(control, {objectName:"2"}) - compare(control.replace([item2], AbstractStackView.Immediate), item2) + compare(control.replace([item2], T.StackView.Immediate), item2) compare(control.depth, 1) compare(control.currentItem, item2) // replace(item, {properties}) var item3 = component.createObject(control) - compare(control.replace(item3, {objectName:"3"}, AbstractStackView.Immediate), item3) + compare(control.replace(item3, {objectName:"3"}, T.StackView.Immediate), item3) compare(item3.objectName, "3") compare(control.depth, 1) compare(control.currentItem, item3) // replace([item, {properties}]) var item4 = component.createObject(control) - compare(control.replace([item4, {objectName:"4"}], AbstractStackView.Immediate), item4) + compare(control.replace([item4, {objectName:"4"}], T.StackView.Immediate), item4) compare(item4.objectName, "4") compare(control.depth, 1) compare(control.currentItem, item4) // replace(component, {properties}) - var item5 = control.replace(component, {objectName:"5"}, AbstractStackView.Immediate) + var item5 = control.replace(component, {objectName:"5"}, T.StackView.Immediate) compare(item5.objectName, "5") compare(control.depth, 1) compare(control.currentItem, item5) // replace([component, {properties}]) - var item6 = control.replace([component, {objectName:"6"}], AbstractStackView.Immediate) + var item6 = control.replace([component, {objectName:"6"}], T.StackView.Immediate) compare(item6.objectName, "6") compare(control.depth, 1) compare(control.currentItem, item6) @@ -429,7 +430,7 @@ TestCase { verify(control) var item1 = component.createObject(control) - control.push(item1, AbstractStackView.Immediate) + control.push(item1, T.StackView.Immediate) verify(item1.visible) var item2 = component.createObject(control) @@ -503,12 +504,12 @@ TestCase { function test_ownership_data() { return [ - {tag:"item, transition", arg: indestructibleItem, operation: AbstractStackView.Transition, destroyed: false}, - {tag:"item, immediate", arg: indestructibleItem, operation: AbstractStackView.Immediate, destroyed: false}, - {tag:"component, transition", arg: destructibleComponent, operation: AbstractStackView.Transition, destroyed: true}, - {tag:"component, immediate", arg: destructibleComponent, operation: AbstractStackView.Immediate, destroyed: true}, - {tag:"url, transition", arg: Qt.resolvedUrl("TestItem.qml"), operation: AbstractStackView.Transition, destroyed: true}, - {tag:"url, immediate", arg: Qt.resolvedUrl("TestItem.qml"), operation: AbstractStackView.Immediate, destroyed: true} + {tag:"item, transition", arg: indestructibleItem, operation: T.StackView.Transition, destroyed: false}, + {tag:"item, immediate", arg: indestructibleItem, operation: T.StackView.Immediate, destroyed: false}, + {tag:"component, transition", arg: destructibleComponent, operation: T.StackView.Transition, destroyed: true}, + {tag:"component, immediate", arg: destructibleComponent, operation: T.StackView.Immediate, destroyed: true}, + {tag:"url, transition", arg: Qt.resolvedUrl("TestItem.qml"), operation: T.StackView.Transition, destroyed: true}, + {tag:"url, immediate", arg: Qt.resolvedUrl("TestItem.qml"), operation: T.StackView.Immediate, destroyed: true} ] } @@ -517,7 +518,7 @@ TestCase { verify(control) // push-pop - control.push(data.arg, AbstractStackView.Immediate) + control.push(data.arg, T.StackView.Immediate) verify(control.currentItem) verify(control.currentItem.hasOwnProperty("destroyedCallback")) var destroyed = false @@ -528,7 +529,7 @@ TestCase { compare(destroyed, data.destroyed) // push-replace - control.push(data.arg, AbstractStackView.Immediate) + control.push(data.arg, T.StackView.Immediate) verify(control.currentItem) verify(control.currentItem.hasOwnProperty("destroyedCallback")) destroyed = false |