aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml1
-rw-r--r--tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp14
-rw-r--r--tests/auto/applicationwindow/tst_applicationwindow.cpp6
-rw-r--r--tests/auto/auto.pro5
-rw-r--r--tests/auto/controls/data/tst_button.qml2
-rw-r--r--tests/auto/controls/data/tst_checkbox.qml2
-rw-r--r--tests/auto/controls/data/tst_combobox.qml147
-rw-r--r--tests/auto/controls/data/tst_control.qml66
-rw-r--r--tests/auto/controls/data/tst_itemdelegate.qml2
-rw-r--r--tests/auto/controls/data/tst_menuitem.qml2
-rw-r--r--tests/auto/controls/data/tst_radiobutton.qml2
-rw-r--r--tests/auto/controls/data/tst_slider.qml47
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml59
-rw-r--r--tests/auto/controls/data/tst_switch.qml2
-rw-r--r--tests/auto/controls/data/tst_tabbutton.qml2
-rw-r--r--tests/auto/controls/data/tst_toolbutton.qml2
-rw-r--r--tests/auto/pressandhold/data/dependencies.qml4
-rw-r--r--tests/auto/pressandhold/tst_pressandhold.cpp15
-rw-r--r--tests/auto/sanity/data/dependencies.qml4
-rw-r--r--tests/auto/sanity/tst_sanity.cpp18
-rw-r--r--tests/auto/snippets/data/dependencies.qml6
-rw-r--r--tests/auto/styles/data/dependencies.qml7
-rw-r--r--tests/auto/styles/tst_styles.cpp2
-rw-r--r--tests/benchmarks/creationtime/data/dependencies.qml7
-rw-r--r--tests/benchmarks/creationtime/tst_creationtime.cpp16
-rw-r--r--tests/benchmarks/objectcount/data/dependencies.qml7
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp18
-rw-r--r--tests/manual/gifs/eventcapturer.cpp2
-rw-r--r--tests/manual/gifs/eventcapturer.h2
-rw-r--r--tests/manual/gifs/gifrecorder.cpp6
-rw-r--r--tests/manual/viewinqwidget/main.cpp2
31 files changed, 391 insertions, 86 deletions
diff --git a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml
index 08ecdda2..93601359 100644
--- a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml
+++ b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml
@@ -143,6 +143,7 @@ Item {
SpinBox {
id: spinbox
objectName: "spinbox"
+ editable: true
value: 50
}
// StackView
diff --git a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp
index c618a2d5..951611f2 100644
--- a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp
+++ b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp
@@ -60,11 +60,9 @@ private slots:
void allControls();
void textControls();
+
private:
QQmlEngine engine;
- bool qt_tab_all_controls() {
- return QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls;
- }
};
tst_activeFocusOnTab::tst_activeFocusOnTab()
@@ -82,8 +80,7 @@ void tst_activeFocusOnTab::cleanup()
void tst_activeFocusOnTab::allControls()
{
- if (!qt_tab_all_controls())
- QSKIP("This platform iterates only text controls. Cannot test iterating all controls.");
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusAllControls);
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -428,12 +425,13 @@ void tst_activeFocusOnTab::allControls()
QVERIFY(item->hasActiveFocus());
delete window;
+
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusBehavior(-1));
}
void tst_activeFocusOnTab::textControls()
{
- if (qt_tab_all_controls())
- QSKIP("This platform iterates all controls. Cannot test iterating text controls only.");
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusTextControls);
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -487,6 +485,8 @@ void tst_activeFocusOnTab::textControls()
QVERIFY(item->hasActiveFocus());
delete window;
+
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusBehavior(-1));
}
QTEST_MAIN(tst_activeFocusOnTab)
diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/applicationwindow/tst_applicationwindow.cpp
index d2937a6d..f78d1f66 100644
--- a/tests/auto/applicationwindow/tst_applicationwindow.cpp
+++ b/tests/auto/applicationwindow/tst_applicationwindow.cpp
@@ -420,7 +420,7 @@ void tst_applicationwindow::attachedProperties()
QCOMPARE(childItem->property("attached_footer").value<QQuickItem *>(), childAppWindow->footer());
QCOMPARE(childItem->property("attached_overlay").value<QQuickItem *>(), childAppWindow->overlay());
- childControl->setParentItem(Q_NULLPTR);
+ childControl->setParentItem(nullptr);
QVERIFY(!childControl->window());
QVERIFY(!childControl->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childControl->property("attached_contentItem").value<QQuickItem *>());
@@ -429,7 +429,7 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(!childControl->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childControl->property("attached_overlay").value<QQuickItem *>());
- childItem->setParentItem(Q_NULLPTR);
+ childItem->setParentItem(nullptr);
QVERIFY(!childItem->window());
QVERIFY(!childItem->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childItem->property("attached_contentItem").value<QQuickItem *>());
@@ -507,7 +507,7 @@ public:
{ QGuiApplicationPrivate::platform_theme = this; }
~TestTheme() { QGuiApplicationPrivate::platform_theme = theme(); }
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE
+ const QFont *font(Font type = SystemFont) const override
{
Q_UNUSED(type);
return &m_font;
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index ec9d4111..25ee9176 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,7 +1,6 @@
TEMPLATE = subdirs
SUBDIRS += \
accessibility \
- activeFocusOnTab \
applicationwindow \
calendar \
controls \
@@ -13,3 +12,7 @@ SUBDIRS += \
snippets \
styles \
universal
+
+# QTBUG-50295
+!linux: SUBDIRS += \
+ activeFocusOnTab
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index 45fad8cb..4127fbf2 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -228,7 +228,7 @@ TestCase {
function test_baseline() {
var control = button.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_checkbox.qml b/tests/auto/controls/data/tst_checkbox.qml
index 4efc7223..7e0c88e4 100644
--- a/tests/auto/controls/data/tst_checkbox.qml
+++ b/tests/auto/controls/data/tst_checkbox.qml
@@ -421,7 +421,7 @@ TestCase {
function test_baseline() {
var control = checkBox.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index b112f20c..6e593967 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.2
+//import QtQuick.Window 2.2
import QtTest 1.0
import Qt.labs.controls 1.0
@@ -46,10 +47,12 @@ TestCase {
id: testCase
width: 200
height: 200
+// visible: true
+// when: windowShown
name: "ComboBox"
ApplicationWindow {
- id: window
+ id: applicationWindow
visible: true
width: 400
height: 400
@@ -74,11 +77,6 @@ TestCase {
}
}
- function initTestCase() {
- window.requestActivate()
- tryCompare(window, "active", true)
- }
-
function init() {
verify(!activatedSpy.target)
compare(activatedSpy.count, 0)
@@ -96,7 +94,7 @@ TestCase {
}
function test_defaults() {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
compare(control.count, 0)
@@ -112,7 +110,7 @@ TestCase {
}
function test_array() {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
var items = [ "Banana", "Apple", "Coconut" ]
@@ -138,7 +136,7 @@ TestCase {
}
function test_objects() {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
var items = [
@@ -168,7 +166,7 @@ TestCase {
}
function test_number() {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
control.model = 10
@@ -201,7 +199,7 @@ TestCase {
}
function test_listModel() {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
control.model = listmodel
@@ -245,7 +243,7 @@ TestCase {
}
function test_textRole(data) {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
control.model = data.model
@@ -273,7 +271,7 @@ TestCase {
}
function test_textAt() {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
control.model = ["Apple", "Orange", "Banana"]
@@ -315,7 +313,7 @@ TestCase {
}
function test_find(data) {
- var control = comboBox.createObject(window.contentItem)
+ var control = comboBox.createObject(testCase)
verify(control)
control.model = ["Banana", "banana", "Coconut", "Apple", "Cocomuffin"]
@@ -325,10 +323,20 @@ TestCase {
control.destroy()
}
- function test_arrowKeys() {
- var control = comboBox.createObject(window.contentItem, {model: 3})
+ function test_arrowKeys_data() {
+ return [
+// { tag: "Window", window: testCase.Window.window },
+ { tag: "ApplicationWindow", window: applicationWindow }
+ ]
+ }
+
+ function test_arrowKeys(data) {
+ var control = comboBox.createObject(data.window.contentItem, {model: 3})
verify(control)
+ data.window.requestActivate()
+ tryCompare(data.window, "active", true)
+
activatedSpy.target = control
verify(activatedSpy.valid)
@@ -456,22 +464,35 @@ TestCase {
function test_keys_data() {
return [
- { tag: "space-space", key1: Qt.Key_Space, key2: Qt.Key_Space, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
- { tag: "space-enter", key1: Qt.Key_Space, key2: Qt.Key_Enter, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
- { tag: "space-return", key1: Qt.Key_Space, key2: Qt.Key_Return, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
- { tag: "space-escape", key1: Qt.Key_Space, key2: Qt.Key_Escape, showPopup: true, showPress: true, hidePopup: true, hidePress: false },
- { tag: "space-0", key1: Qt.Key_Space, key2: Qt.Key_0, showPopup: true, showPress: true, hidePopup: false, hidePress: false },
-
- { tag: "enter-enter", key1: Qt.Key_Enter, key2: Qt.Key_Enter, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
- { tag: "return-return", key1: Qt.Key_Return, key2: Qt.Key_Return, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
- { tag: "escape-escape", key1: Qt.Key_Escape, key2: Qt.Key_Escape, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+// { tag: "Window: space-space", window: testCase.Window.window, key1: Qt.Key_Space, key2: Qt.Key_Space, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+// { tag: "Window: space-enter", window: testCase.Window.window, key1: Qt.Key_Space, key2: Qt.Key_Enter, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+// { tag: "Window: space-return", window: testCase.Window.window, key1: Qt.Key_Space, key2: Qt.Key_Return, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+// { tag: "Window: space-escape", window: testCase.Window.window, key1: Qt.Key_Space, key2: Qt.Key_Escape, showPopup: true, showPress: true, hidePopup: true, hidePress: false },
+// { tag: "Window: space-0", window: testCase.Window.window, key1: Qt.Key_Space, key2: Qt.Key_0, showPopup: true, showPress: true, hidePopup: false, hidePress: false },
+// { tag: "Window: enter-enter", window: testCase.Window.window, key1: Qt.Key_Enter, key2: Qt.Key_Enter, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+// { tag: "Window: return-return", window: testCase.Window.window, key1: Qt.Key_Return, key2: Qt.Key_Return, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+// { tag: "Window: escape-escape", window: testCase.Window.window, key1: Qt.Key_Escape, key2: Qt.Key_Escape, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+
+ { tag: "ApplicationWindow: space-space", window: applicationWindow, key1: Qt.Key_Space, key2: Qt.Key_Space, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+ { tag: "ApplicationWindow: space-enter", window: applicationWindow, key1: Qt.Key_Space, key2: Qt.Key_Enter, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+ { tag: "ApplicationWindow: space-return", window: applicationWindow, key1: Qt.Key_Space, key2: Qt.Key_Return, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+ { tag: "ApplicationWindow: space-escape", window: applicationWindow, key1: Qt.Key_Space, key2: Qt.Key_Escape, showPopup: true, showPress: true, hidePopup: true, hidePress: false },
+ { tag: "ApplicationWindow: space-0", window: applicationWindow, key1: Qt.Key_Space, key2: Qt.Key_0, showPopup: true, showPress: true, hidePopup: false, hidePress: false },
+ { tag: "ApplicationWindow: enter-enter", window: applicationWindow, key1: Qt.Key_Enter, key2: Qt.Key_Enter, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+ { tag: "ApplicationWindow: return-return", window: applicationWindow, key1: Qt.Key_Return, key2: Qt.Key_Return, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+ { tag: "ApplicationWindow: escape-escape", window: applicationWindow, key1: Qt.Key_Escape, key2: Qt.Key_Escape, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
]
}
function test_keys(data) {
- var control = comboBox.createObject(window.contentItem, {model: 3})
+ var control = comboBox.createObject(data.window.contentItem, {model: 3})
verify(control)
+ data.window.requestActivate()
+ tryCompare(data.window, "active", true)
+
+ waitForRendering(control)
+
control.forceActiveFocus()
verify(control.activeFocus)
@@ -497,8 +518,15 @@ TestCase {
control.destroy()
}
- function test_popup() {
- var control = comboBox.createObject(window.contentItem, {model: 3})
+ function test_popup_data() {
+ return [
+// { tag: "Window", window: testCase.Window.window },
+ { tag: "ApplicationWindow", window: applicationWindow }
+ ]
+ }
+
+ function test_popup(data) {
+ var control = comboBox.createObject(data.window.contentItem, {model: 3})
verify(control)
// show below
@@ -516,7 +544,7 @@ TestCase {
tryCompare(control.popup, "visible", false)
// show above
- control.y = window.height - control.height
+ control.y = data.window.height - control.height
mousePress(control)
compare(control.pressed, true)
compare(control.popup.visible, false)
@@ -528,10 +556,20 @@ TestCase {
control.destroy()
}
- function test_mouse() {
- var control = comboBox.createObject(window.contentItem, {model: 3})
+ function test_mouse_data() {
+ return [
+// { tag: "Window", window: testCase.Window.window },
+ { tag: "ApplicationWindow", window: applicationWindow }
+ ]
+ }
+
+ function test_mouse(data) {
+ var control = comboBox.createObject(data.window.contentItem, {model: 3})
verify(control)
+ data.window.requestActivate()
+ tryCompare(data.window, "active", true)
+
activatedSpy.target = control
verify(activatedSpy.valid)
@@ -571,18 +609,29 @@ TestCase {
control.destroy()
}
- function test_focus() {
- var control = comboBox.createObject(window.contentItem, {model: 3})
+ function test_focus_data() {
+ return [
+// { tag: "Window", window: testCase.Window.window },
+ { tag: "ApplicationWindow", window: applicationWindow }
+ ]
+ }
+
+ function test_focus(data) {
+ var control = comboBox.createObject(data.window.contentItem, {model: 3})
verify(control)
+ data.window.requestActivate()
+ tryCompare(data.window, "active", true)
+
+ waitForRendering(control)
+
// click - gain focus - show popup
mouseClick(control)
verify(control.activeFocus)
compare(control.popup.visible, true)
// lose focus - hide popup
- window.contentItem.forceActiveFocus()
- verify(window.contentItem.activeFocus)
+ control.focus = false
verify(!control.activeFocus)
tryCompare(control.popup, "visible", false)
@@ -671,16 +720,13 @@ TestCase {
}
function test_font() { // QTBUG_50984
- var control = component.createObject(window.contentItem)
+ var control = component.createObject(applicationWindow.contentItem)
verify(control)
verify(control.button)
verify(control.combobox)
waitForRendering(control)
- control.forceActiveFocus()
- verify(control.activeFocus)
-
compare(control.font.pixelSize, 30)
compare(control.button.font.pixelSize, 20)
compare(control.combobox.font.pixelSize, 30)
@@ -717,4 +763,27 @@ TestCase {
control.destroy()
}
+
+ function test_wheel(data) {
+ var control = comboBox.createObject(applicationWindow.contentItem, {model: 2, wheelEnabled: true})
+ verify(control)
+
+ var delta = 120
+
+ mouseWheel(control, control.width / 2, control.height / 2, -delta, -delta)
+ compare(control.currentIndex, 1)
+
+ // reached bounds -> no change
+ mouseWheel(control, control.width / 2, control.height / 2, -delta, -delta)
+ compare(control.currentIndex, 1)
+
+ mouseWheel(control, control.width / 2, control.height / 2, delta, delta)
+ compare(control.currentIndex, 0)
+
+ // reached bounds -> no change
+ mouseWheel(control, control.width / 2, control.height / 2, delta, delta)
+ compare(control.currentIndex, 0)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml
index 7fe61064..9d63f429 100644
--- a/tests/auto/controls/data/tst_control.qml
+++ b/tests/auto/controls/data/tst_control.qml
@@ -56,6 +56,11 @@ TestCase {
T.Control { }
}
+ Component {
+ id: button
+ T.Button { }
+ }
+
SignalSpy {
id: mirroredSpy
signalName: "mirroredChanged"
@@ -849,4 +854,65 @@ TestCase {
control.destroy()
}
+
+ function test_focusPolicy() {
+ var control = button.createObject(testCase, {width: 100, height: 100})
+ verify(control)
+
+ // Qt.TabFocus vs. Item::activeFocusOnTab
+ control.activeFocusOnTab = true
+ compare(control.focusPolicy, Qt.TabFocus)
+ control.activeFocusOnTab = false
+ compare(control.focusPolicy, Qt.NoFocus)
+
+ control.focusPolicy = Qt.TabFocus
+ compare(control.focusPolicy, Qt.TabFocus)
+ compare(control.activeFocusOnTab, true)
+
+ // Qt.ClickFocus
+ mouseClick(control)
+ verify(!control.activeFocus)
+
+ control.focusPolicy = Qt.ClickFocus
+ compare(control.focusPolicy, Qt.ClickFocus)
+
+ mouseClick(control)
+ verify(control.activeFocus)
+
+ control.focus = false
+ verify(!control.activeFocus)
+
+ // Qt.WheelFocus
+ mouseWheel(control, control.width / 2, control.height / 2, 10)
+ verify(!control.activeFocus)
+
+ control.focusPolicy = Qt.WheelFocus
+ compare(control.focusPolicy, Qt.WheelFocus)
+
+ mouseWheel(control, control.width / 2, control.height / 2, 10)
+ verify(control.activeFocus)
+
+ control.destroy()
+ }
+
+ function test_hover() {
+ var control = component.createObject(testCase, {width: 100, height: 100})
+ verify(control)
+
+ compare(control.hovered, false)
+ compare(control.hoverEnabled, false)
+
+ mouseMove(control, control.width / 2, control.height / 2)
+ compare(control.hovered, false)
+
+ control.hoverEnabled = true
+
+ mouseMove(control, control.width / 2, control.height / 2)
+ compare(control.hovered, true)
+
+ mouseMove(control, -10, -10)
+ compare(control.hovered, false)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_itemdelegate.qml b/tests/auto/controls/data/tst_itemdelegate.qml
index e2f78ac5..f2fd3794 100644
--- a/tests/auto/controls/data/tst_itemdelegate.qml
+++ b/tests/auto/controls/data/tst_itemdelegate.qml
@@ -58,7 +58,7 @@ TestCase {
function test_baseline() {
var control = itemDelegate.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_menuitem.qml b/tests/auto/controls/data/tst_menuitem.qml
index 8581a43f..8c9bc71b 100644
--- a/tests/auto/controls/data/tst_menuitem.qml
+++ b/tests/auto/controls/data/tst_menuitem.qml
@@ -58,7 +58,7 @@ TestCase {
function test_baseline() {
var control = menuItem.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_radiobutton.qml b/tests/auto/controls/data/tst_radiobutton.qml
index d4cdf0ad..1b105f08 100644
--- a/tests/auto/controls/data/tst_radiobutton.qml
+++ b/tests/auto/controls/data/tst_radiobutton.qml
@@ -312,7 +312,7 @@ TestCase {
function test_baseline() {
var control = radioButton.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 53e2fb8f..7b38f440 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -471,4 +471,51 @@ TestCase {
control.destroy()
}
+
+ function test_wheel_data() {
+ return [
+ { tag: "horizontal", orientation: Qt.Horizontal, dx: 120, dy: 0 },
+ { tag: "vertical", orientation: Qt.Vertical, dx: 0, dy: 120 }
+ ]
+ }
+
+ function test_wheel(data) {
+ var control = slider.createObject(testCase, {wheelEnabled: true, orientation: data.orientation})
+ verify(control)
+
+ compare(control.value, 0.0)
+
+ mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy)
+ compare(control.value, 0.1)
+ compare(control.position, 0.1)
+
+ control.stepSize = 0.2
+
+ mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy)
+ compare(control.value, 0.3)
+ compare(control.position, 0.3)
+
+ control.stepSize = 10.0
+
+ mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy)
+ compare(control.value, 0.0)
+ compare(control.position, 0.0)
+
+ control.to = 10.0
+ control.stepSize = 5.0
+
+ mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy)
+ compare(control.value, 5.0)
+ compare(control.position, 0.5)
+
+ mouseWheel(control, control.width / 2, control.height / 2, 0.5 * data.dx, 0.5 * data.dy)
+ compare(control.value, 7.5)
+ compare(control.position, 0.75)
+
+ mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy)
+ compare(control.value, 2.5)
+ compare(control.position, 0.25)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index cdea8b66..e76725b6 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -87,6 +87,7 @@ TestCase {
compare(control.to, 99)
compare(control.value, 0)
compare(control.stepSize, 1)
+ compare(control.editable, false)
compare(control.up.pressed, false)
compare(control.down.pressed, false)
@@ -326,4 +327,62 @@ TestCase {
control.destroy()
}
+
+ function test_editable() {
+ var control = spinBox.createObject(testCase)
+ verify(control)
+
+ control.contentItem.forceActiveFocus()
+ compare(control.contentItem.activeFocus, true)
+
+ compare(control.editable, false)
+ control.contentItem.selectAll()
+ keyClick(Qt.Key_5)
+ keyClick(Qt.Key_Return)
+ compare(control.value, 0)
+
+ control.editable = true
+ compare(control.editable, true)
+ control.contentItem.selectAll()
+ keyClick(Qt.Key_5)
+ keyClick(Qt.Key_Return)
+ compare(control.value, 5)
+
+ control.destroy()
+ }
+
+ function test_wheel(data) {
+ var control = spinBox.createObject(testCase, {wheelEnabled: true})
+ verify(control)
+
+ var delta = 120
+
+ compare(control.value, 0)
+
+ mouseWheel(control, control.width / 2, control.height / 2, delta, delta)
+ compare(control.value, 1)
+
+ control.stepSize = 2
+
+ mouseWheel(control, control.width / 2, control.height / 2, delta, delta)
+ compare(control.value, 3)
+
+ control.stepSize = 10
+
+ mouseWheel(control, control.width / 2, control.height / 2, -delta, -delta)
+ compare(control.value, 0)
+
+ control.stepSize = 5
+
+ mouseWheel(control, control.width / 2, control.height / 2, delta, delta)
+ compare(control.value, 5)
+
+ mouseWheel(control, control.width / 2, control.height / 2, 0.5 * delta, 0.5 * delta)
+ compare(control.value, 8)
+
+ mouseWheel(control, control.width / 2, control.height / 2, -delta, -delta)
+ compare(control.value, 3)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_switch.qml b/tests/auto/controls/data/tst_switch.qml
index 13924ed0..7443f330 100644
--- a/tests/auto/controls/data/tst_switch.qml
+++ b/tests/auto/controls/data/tst_switch.qml
@@ -260,7 +260,7 @@ TestCase {
function test_baseline() {
var control = swtch.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_tabbutton.qml b/tests/auto/controls/data/tst_tabbutton.qml
index 3a817cfd..f755c081 100644
--- a/tests/auto/controls/data/tst_tabbutton.qml
+++ b/tests/auto/controls/data/tst_tabbutton.qml
@@ -85,7 +85,7 @@ TestCase {
function test_baseline() {
var control = tabButton.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml
index 63a87ec2..6c03f18c 100644
--- a/tests/auto/controls/data/tst_toolbutton.qml
+++ b/tests/auto/controls/data/tst_toolbutton.qml
@@ -173,7 +173,7 @@ TestCase {
function test_baseline() {
var control = toolButton.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/pressandhold/data/dependencies.qml b/tests/auto/pressandhold/data/dependencies.qml
new file mode 100644
index 00000000..13690bbc
--- /dev/null
+++ b/tests/auto/pressandhold/data/dependencies.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Control { }
diff --git a/tests/auto/pressandhold/tst_pressandhold.cpp b/tests/auto/pressandhold/tst_pressandhold.cpp
index 8c4cf673..f61c9f56 100644
--- a/tests/auto/pressandhold/tst_pressandhold.cpp
+++ b/tests/auto/pressandhold/tst_pressandhold.cpp
@@ -37,13 +37,14 @@
#include <QtTest>
#include <QtQuick>
-// TODO: add QStyleHints::setMousePressAndHoldInterval() to speedup the test
-
class tst_PressAndHold : public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
void pressAndHold_data();
void pressAndHold();
@@ -51,6 +52,16 @@ private slots:
void keepSelection();
};
+void tst_PressAndHold::initTestCase()
+{
+ QGuiApplication::styleHints()->setMousePressAndHoldInterval(100);
+}
+
+void tst_PressAndHold::cleanupTestCase()
+{
+ QGuiApplication::styleHints()->setMousePressAndHoldInterval(-1);
+}
+
void tst_PressAndHold::pressAndHold_data()
{
QTest::addColumn<QByteArray>("data");
diff --git a/tests/auto/sanity/data/dependencies.qml b/tests/auto/sanity/data/dependencies.qml
new file mode 100644
index 00000000..13690bbc
--- /dev/null
+++ b/tests/auto/sanity/data/dependencies.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Control { }
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index bc114d62..7f438721 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -267,14 +267,18 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt
// the engine's import path. This way we can use QQmlComponent to load each QML file
// for benchmarking.
- QFileInfoList entries = QDir(QQC2_IMPORT_PATH + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
foreach (const QFileInfo &entry, entries) {
QString name = entry.baseName();
if (!skiplist.contains(name)) {
foreach (const QString &importPath, engine->importPathList()) {
- QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName());
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName();
if (QFile::exists(filePath)) {
- QTest::newRow(qPrintable(entry.dir().dirName() + "/" + entry.fileName())) << QUrl::fromLocalFile(filePath);
+ QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
+ break;
+ } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) {
+ QTest::newRow(qPrintable(name)) << QUrl(filePath);
break;
}
}
@@ -305,10 +309,10 @@ void tst_Sanity::attachedObjects()
void tst_Sanity::attachedObjects_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/calendar");
- addTestRows(&engine, "/controls");
- addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle");
- addTestRows(&engine, "/controls/universal");
+ addTestRows(&engine, "calendar");
+ addTestRows(&engine, "controls");
+ addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle");
+ addTestRows(&engine, "controls/universal");
}
QTEST_MAIN(tst_Sanity)
diff --git a/tests/auto/snippets/data/dependencies.qml b/tests/auto/snippets/data/dependencies.qml
new file mode 100644
index 00000000..15fa1a9a
--- /dev/null
+++ b/tests/auto/snippets/data/dependencies.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.calendar 1.0
+
+Control { }
diff --git a/tests/auto/styles/data/dependencies.qml b/tests/auto/styles/data/dependencies.qml
new file mode 100644
index 00000000..310fbf40
--- /dev/null
+++ b/tests/auto/styles/data/dependencies.qml
@@ -0,0 +1,7 @@
+import QtTest 1.0
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+
+Control { }
diff --git a/tests/auto/styles/tst_styles.cpp b/tests/auto/styles/tst_styles.cpp
index b45366b6..fad28d85 100644
--- a/tests/auto/styles/tst_styles.cpp
+++ b/tests/auto/styles/tst_styles.cpp
@@ -62,6 +62,8 @@ int main(int argc, char *argv[])
process.start(argv[0], app.arguments().mid(1));
process.waitForFinished();
+ if (process.exitStatus() != QProcess::NormalExit)
+ return -1;
failures += process.exitCode();
}
diff --git a/tests/benchmarks/creationtime/data/dependencies.qml b/tests/benchmarks/creationtime/data/dependencies.qml
new file mode 100644
index 00000000..65fb0414
--- /dev/null
+++ b/tests/benchmarks/creationtime/data/dependencies.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.calendar 1.0
+
+Control { }
diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp
index 2a61b0ea..927dd17d 100644
--- a/tests/benchmarks/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/creationtime/tst_creationtime.cpp
@@ -78,15 +78,19 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt
// the engine's import path. This way we can use QQmlComponent to load each QML file
// for benchmarking.
- QFileInfoList entries = QDir(QQC2_IMPORT_PATH + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
foreach (const QFileInfo &entry, entries) {
QString name = entry.baseName();
if (!skiplist.contains(name)) {
foreach (const QString &importPath, engine->importPathList()) {
- QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName());
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName();
if (QFile::exists(filePath)) {
QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
break;
+ } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) {
+ QTest::newRow(qPrintable(name)) << QUrl(filePath);
+ break;
}
}
}
@@ -117,7 +121,7 @@ void tst_CreationTime::controls()
void tst_CreationTime::controls_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls");
+ addTestRows(&engine, "controls");
}
void tst_CreationTime::material()
@@ -129,7 +133,7 @@ void tst_CreationTime::material()
void tst_CreationTime::material_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle");
+ addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle");
}
void tst_CreationTime::universal()
@@ -141,7 +145,7 @@ void tst_CreationTime::universal()
void tst_CreationTime::universal_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/universal");
+ addTestRows(&engine, "controls/universal");
}
void tst_CreationTime::calendar()
@@ -153,7 +157,7 @@ void tst_CreationTime::calendar()
void tst_CreationTime::calendar_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/calendar");
+ addTestRows(&engine, "calendar");
}
QTEST_MAIN(tst_CreationTime)
diff --git a/tests/benchmarks/objectcount/data/dependencies.qml b/tests/benchmarks/objectcount/data/dependencies.qml
new file mode 100644
index 00000000..65fb0414
--- /dev/null
+++ b/tests/benchmarks/objectcount/data/dependencies.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.calendar 1.0
+
+Control { }
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index b479b0e2..51a968d0 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -84,7 +84,7 @@ void tst_ObjectCount::init()
// warmup
QQmlComponent component(&engine);
- component.setData("import QtQuick 2.0; import QtQuick.Controls 1.3 as C1; import Qt.labs.controls 1.0 as C2; Row { C1.Button {} C2.Button {} }", QUrl());
+ component.setData("import QtQuick 2.0; import Qt.labs.controls 1.0; Item { Button {} }", QUrl());
delete component.create();
}
@@ -118,15 +118,19 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt
// the engine's import path. This way we can use QQmlComponent to load each QML file
// for benchmarking.
- QFileInfoList entries = QDir(QQC2_IMPORT_PATH + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
foreach (const QFileInfo &entry, entries) {
QString name = entry.baseName();
if (!skiplist.contains(name)) {
foreach (const QString &importPath, engine->importPathList()) {
- QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName());
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName();
if (QFile::exists(filePath)) {
QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
break;
+ } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) {
+ QTest::newRow(qPrintable(name)) << QUrl(filePath);
+ break;
}
}
}
@@ -161,7 +165,7 @@ void tst_ObjectCount::calendar()
void tst_ObjectCount::calendar_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/calendar");
+ addTestRows(&engine, "calendar");
}
void tst_ObjectCount::controls()
@@ -173,7 +177,7 @@ void tst_ObjectCount::controls()
void tst_ObjectCount::controls_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls");
+ addTestRows(&engine, "controls");
}
void tst_ObjectCount::material()
@@ -185,7 +189,7 @@ void tst_ObjectCount::material()
void tst_ObjectCount::material_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle");
+ addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle");
}
void tst_ObjectCount::universal()
@@ -197,7 +201,7 @@ void tst_ObjectCount::universal()
void tst_ObjectCount::universal_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/universal");
+ addTestRows(&engine, "controls/universal");
}
QTEST_MAIN(tst_ObjectCount)
diff --git a/tests/manual/gifs/eventcapturer.cpp b/tests/manual/gifs/eventcapturer.cpp
index 5b5905cd..83e1c76b 100644
--- a/tests/manual/gifs/eventcapturer.cpp
+++ b/tests/manual/gifs/eventcapturer.cpp
@@ -69,7 +69,7 @@
EventCapturer::EventCapturer(QObject *parent) :
QObject(parent),
- mEventSource(Q_NULLPTR),
+ mEventSource(nullptr),
mStopCaptureKey(Qt::Key_Escape),
mMoveEventTrimFlags(TrimNone),
mDuration(0),
diff --git a/tests/manual/gifs/eventcapturer.h b/tests/manual/gifs/eventcapturer.h
index b1f2b4ff..7982d6e9 100644
--- a/tests/manual/gifs/eventcapturer.h
+++ b/tests/manual/gifs/eventcapturer.h
@@ -74,7 +74,7 @@ public:
QVector<CapturedEvent> capturedEvents() const;
protected:
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
private slots:
void stopCapturing();
diff --git a/tests/manual/gifs/gifrecorder.cpp b/tests/manual/gifs/gifrecorder.cpp
index 3ba33552..134ece2e 100644
--- a/tests/manual/gifs/gifrecorder.cpp
+++ b/tests/manual/gifs/gifrecorder.cpp
@@ -64,8 +64,8 @@ namespace {
}
GifRecorder::GifRecorder() :
- QObject(Q_NULLPTR),
- mWindow(Q_NULLPTR),
+ QObject(nullptr),
+ mWindow(nullptr),
mHighQuality(false),
mRecordingDuration(0),
mRecordCursor(false),
@@ -83,7 +83,7 @@ GifRecorder::GifRecorder() :
void GifRecorder::setRecordingDuration(int duration)
{
QVERIFY2(duration >= 1, qPrintable(QString::fromLatin1("Recording duration %1 must be larger than 1 second").arg(duration)));
- QVERIFY2(duration < 10, qPrintable(QString::fromLatin1("Recording duration %1 must be less than 10 seconds").arg(duration)));
+ QVERIFY2(duration < 20, qPrintable(QString::fromLatin1("Recording duration %1 must be less than 20 seconds").arg(duration)));
mRecordingDuration = duration;
}
diff --git a/tests/manual/viewinqwidget/main.cpp b/tests/manual/viewinqwidget/main.cpp
index ff949544..3611e071 100644
--- a/tests/manual/viewinqwidget/main.cpp
+++ b/tests/manual/viewinqwidget/main.cpp
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
const QUrl gallerySource(QLatin1String("qrc:/gallery.qml"));
QQmlApplicationEngine engine(gallerySource);
- QObject *root = engine.rootObjects().value(0, Q_NULLPTR);
+ QObject *root = engine.rootObjects().value(0, nullptr);
if (!root || !root->isWindowType()) {
qWarning() << "Load error" << gallerySource;
return 1;