diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 70 | ||||
-rw-r--r-- | tests/auto/qquickstyle/tst_qquickstyle.cpp | 8 |
2 files changed, 77 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 2ba9be8f..d0cdfb17 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -65,7 +65,7 @@ TestCase { id: emptyBox ComboBox { delegate: ItemDelegate { - width: popup.width + width: parent.width } } } @@ -713,6 +713,74 @@ TestCase { control.destroy() } + function test_down() { + var control = comboBox.createObject(testCase, {model: 3}) + verify(control) + + // some styles position the popup over the combo button. move it out + // of the way to avoid stealing mouse presses. we want to test the + // combinations of the button being pressed and the popup being visible. + control.popup.y = control.height + + var downSpy = signalSpy.createObject(control, {target: control, signalName: "downChanged"}) + verify(downSpy.valid) + + var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"}) + verify(pressedSpy.valid) + + mousePress(control) + compare(control.popup.visible, false) + compare(control.pressed, true) + compare(control.down, true) + compare(downSpy.count, 1) + compare(pressedSpy.count, 1) + + mouseRelease(control) + compare(control.popup.visible, true) + compare(control.pressed, false) + compare(control.down, true) + compare(downSpy.count, 3) + compare(pressedSpy.count, 2) + + control.down = false + compare(control.down, false) + compare(downSpy.count, 4) + + mousePress(control) + compare(control.popup.visible, true) + compare(control.pressed, true) + compare(control.down, false) // explicit false + compare(downSpy.count, 4) + compare(pressedSpy.count, 3) + + control.down = undefined + compare(control.down, true) + compare(downSpy.count, 5) + + mouseRelease(control) + tryCompare(control.popup, "visible", false) + compare(control.pressed, false) + compare(control.down, false) + compare(downSpy.count, 6) + compare(pressedSpy.count, 4) + + control.popup.open() + compare(control.popup.visible, true) + compare(control.pressed, false) + compare(control.down, true) + compare(downSpy.count, 7) + compare(pressedSpy.count, 4) + + control.popup.close() + tryCompare(control.popup, "visible", false) + compare(control.pressed, false) + compare(control.down, false) + compare(downSpy.count, 8) + compare(pressedSpy.count, 4) + + control.destroy() + } + function test_focus() { var control = comboBox.createObject(testCase, {model: 3}) verify(control) diff --git a/tests/auto/qquickstyle/tst_qquickstyle.cpp b/tests/auto/qquickstyle/tst_qquickstyle.cpp index 15edc67b..cc9cc75d 100644 --- a/tests/auto/qquickstyle/tst_qquickstyle.cpp +++ b/tests/auto/qquickstyle/tst_qquickstyle.cpp @@ -50,6 +50,7 @@ private slots: void lookup(); void commandLineArgument(); void environmentVariables(); + void availableStyles(); }; void tst_QQuickStyle::init() @@ -94,6 +95,13 @@ void tst_QQuickStyle::environmentVariables() QCOMPARE(QQuickStylePrivate::fallbackStyle(), QString("EnvVarFallbackStyle")); } +void tst_QQuickStyle::availableStyles() +{ + QStringList styles = QQuickStyle::availableStyles(); + QVERIFY(!styles.isEmpty()); + QCOMPARE(styles.first(), QString("Default")); +} + QTEST_MAIN(tst_QQuickStyle) #include "tst_qquickstyle.moc" |