summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-06-21 10:08:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-02 11:20:18 +0200
commit8f8deec53e32119a80b2ff5e8cad83cfd7e5776c (patch)
tree2266c69145974aad5303a7caad68e09817672c1f
parentc79ed398e6d70717243feccb78e362ed1ee819eb (diff)
downloadqtquickcontrols-8f8deec53e32119a80b2ff5e8cad83cfd7e5776c.tar.gz
Tests: Fix warnings in tests
Ignore warning messages when they are expected. Fix real warnings. Also add missing tst_layout.qml to the test pro file. Change-Id: I2a3835d386570aeb993f275793b3e5e69cc41599 Reviewed-by: Liang Qi <liang.qi@digia.com>
-rw-r--r--tests/auto/controls/controls.pro3
-rw-r--r--tests/auto/controls/data/tst_layout.qml1
-rw-r--r--tests/auto/controls/data/tst_shortcuts.qml27
-rw-r--r--tests/auto/controls/data/tst_statusbar.qml2
-rw-r--r--tests/auto/controls/data/tst_tableview.qml13
-rw-r--r--tests/auto/controls/data/tst_textfield.qml22
-rw-r--r--tests/auto/controls/data/tst_toolbar.qml2
7 files changed, 41 insertions, 29 deletions
diff --git a/tests/auto/controls/controls.pro b/tests/auto/controls/controls.pro
index a1ec024f..49f8f0f3 100644
--- a/tests/auto/controls/controls.pro
+++ b/tests/auto/controls/controls.pro
@@ -40,4 +40,5 @@ OTHER_FILES += \
$$PWD/data/tst_checkbox.qml \
$$PWD/data/tst_groupbox.qml \
$$PWD/data/tst_splitview.qml \
- $$PWD/data/tst_styles.qml
+ $$PWD/data/tst_styles.qml \
+ $$PWD/data/tst_layout.qml
diff --git a/tests/auto/controls/data/tst_layout.qml b/tests/auto/controls/data/tst_layout.qml
index 2e25b96c..8ce582db 100644
--- a/tests/auto/controls/data/tst_layout.qml
+++ b/tests/auto/controls/data/tst_layout.qml
@@ -49,6 +49,7 @@ TestCase {
height:400
function test_invalidParent() {
+ ignoreWarning('Layout must be attached to Item elements')
var object = Qt.createQmlObject('import QtQuick 2.1; import QtQuick.Layouts 1.0; QtObject { Layout.fillWidth: true }', testCase, '');
object.destroy()
}
diff --git a/tests/auto/controls/data/tst_shortcuts.qml b/tests/auto/controls/data/tst_shortcuts.qml
index b28d24a9..80f34192 100644
--- a/tests/auto/controls/data/tst_shortcuts.qml
+++ b/tests/auto/controls/data/tst_shortcuts.qml
@@ -67,18 +67,19 @@ TestCase {
function test_shortcut_data() {
return [
- { key: Qt.Key_A, modifier: Qt.NoModifier, expected: "a pressed" },
- { key: Qt.Key_B, modifier: Qt.NoModifier, expected: "b pressed" },
- { key: Qt.Key_C, modifier: Qt.NoModifier, expected: "no key press" },
- { key: Qt.Key_C, modifier: Qt.ControlModifier, expected: "ctrl c pressed" },
- { key: Qt.Key_D, modifier: Qt.NoModifier, expected: "d pressed" },
- { key: Qt.Key_D, modifier: Qt.ControlModifier, expected: "no key press" },
+ { tag: "a_pressed", key: Qt.Key_A, modifier: Qt.NoModifier, expected: "a pressed" },
+ { tag: "b_pressed", key: Qt.Key_B, modifier: Qt.NoModifier, expected: "b pressed" },
+ { tag: "nokey_pressed1", key: Qt.Key_C, modifier: Qt.NoModifier, expected: "no key press" },
+ { tag: "ctrlc_pressed", key: Qt.Key_C, modifier: Qt.ControlModifier, expected: "ctrl c pressed" },
+ { tag: "dpressed", key: Qt.Key_D, modifier: Qt.NoModifier, expected: "d pressed" },
+ { tag: "nokey_pressed2", key: Qt.Key_D, modifier: Qt.ControlModifier, expected: "no key press" },
// shift d is not triggered because it is overloaded
- { key: Qt.Key_D, modifier: Qt.ShiftModifier, expected: "no key press" },
- { key: Qt.Key_D, modifier: Qt.AltModifier, expected: "alt d pressed" },
- { key: Qt.Key_T, modifier: Qt.NoModifier, expected: "no key press" },
+ { tag: "overloaded", key: Qt.Key_D, modifier: Qt.ShiftModifier, expected: "no key press",
+ warning: "QQuickAction::event: Ambiguous shortcut overload: Shift+D" },
+ { tag: "aldd_pressed", key: Qt.Key_D, modifier: Qt.AltModifier, expected: "alt d pressed" },
+ { tag: "nokey_pressed3", key: Qt.Key_T, modifier: Qt.NoModifier, expected: "no key press" },
// on mac we don't have mnemonics
- { key: Qt.Key_T, modifier: Qt.AltModifier, expected: Qt.platform.os === "osx" ? "no key press" : "alt t pressed" },
+ { tag: "mnemonics", key: Qt.Key_T, modifier: Qt.AltModifier, expected: Qt.platform.os === "osx" ? "no key press" : "alt t pressed" },
]
}
@@ -88,6 +89,12 @@ TestCase {
var text = rootObject.children[0];
text.text = "no key press";
+ if (data.warning !== undefined) {
+ if (Qt.platform.os === "osx" && data.tag === "overloaded")
+ ignoreWarning("QQuickAction::event: Ambiguous shortcut overload: ?D") // QTBUG_32089
+ else
+ ignoreWarning(data.warning)
+ }
keyPress(data.key, data.modifier);
verify(text != undefined);
diff --git a/tests/auto/controls/data/tst_statusbar.qml b/tests/auto/controls/data/tst_statusbar.qml
index e95e14bb..dfa19813 100644
--- a/tests/auto/controls/data/tst_statusbar.qml
+++ b/tests/auto/controls/data/tst_statusbar.qml
@@ -55,7 +55,7 @@ TestCase {
height:400
function test_createStatusBar() {
- var statusBar = Qt.createQmlObject('import QtQuick.Controls 1.0; StatusBar {}', testCase, '');
+ var statusBar = Qt.createQmlObject('import QtQuick.Controls 1.0; StatusBar {}', container, '');
statusBar.destroy()
}
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index 9a5e9c78..8e576113 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -363,6 +363,7 @@ TestCase {
compare(column.__view, tableView)
compare(column.width, tableView.viewport.width)
var tableView2 = Qt.createQmlObject('import QtQuick 2.1; import QtQuick.Controls 1.0; TableView { }', testCase, '');
+ ignoreWarning("TableView::insertColumn(): you cannot add a column to multiple views")
tableView2.addColumn(column) // should not work
compare(column.__view, tableView) //same as before
tableView2.destroy()
@@ -452,11 +453,11 @@ TestCase {
{tag:"2->1 (2)", from: 2, to: 1},
{tag:"0->0", from: 0, to: 0},
- {tag:"-1->0", from: -1, to: 0},
- {tag:"0->-1", from: 0, to: -1},
- {tag:"1->10", from: 1, to: 10},
- {tag:"10->2", from: 10, to: 2},
- {tag:"10->-1", from: 10, to: -1}
+ {tag:"-1->0", from: -1, to: 0, warning: "TableView::moveColumn(): invalid argument"},
+ {tag:"0->-1", from: 0, to: -1, warning: "TableView::moveColumn(): invalid argument"},
+ {tag:"1->10", from: 1, to: 10, warning: "TableView::moveColumn(): invalid argument"},
+ {tag:"10->2", from: 10, to: 2, warning: "TableView::moveColumn(): invalid argument"},
+ {tag:"10->-1", from: 10, to: -1, warning: "TableView::moveColumn(): invalid argument"}
]
}
@@ -474,6 +475,8 @@ TestCase {
for (i = 0; i < tableView.columnCount; ++i)
compare(tableView.getColumn(i).title, titles[i])
+ if (data.warning !== undefined)
+ ignoreWarning(data.warning)
tableView.moveColumn(data.from, data.to)
compare(tableView.columnCount, titles.length)
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index 382e07c6..6c754f10 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -80,7 +80,7 @@ TestCase {
function test_readonly() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
compare(textfield.readOnly, false)
@@ -92,7 +92,7 @@ TestCase {
}
function test_inputMask() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container , '')
textfield.forceActiveFocus()
// +/- not required, 1 digit required, 1 aphabetic character required and 2 digits not required
@@ -145,7 +145,7 @@ TestCase {
}
function test_selectAll() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -157,7 +157,7 @@ TestCase {
}
function test_select() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -172,7 +172,7 @@ TestCase {
}
function test_cursorPosition() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
compare(textfield.cursorPosition, 0)
@@ -188,7 +188,7 @@ TestCase {
}
function test_selectWord() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -212,7 +212,7 @@ TestCase {
}
function test_getText() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -222,7 +222,7 @@ TestCase {
}
function test_insert() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -232,7 +232,7 @@ TestCase {
}
function test_deselect() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -243,7 +243,7 @@ TestCase {
}
function test_undo() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
@@ -255,7 +255,7 @@ TestCase {
}
function test_redo() {
- var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', testCase, '')
+ var textfield = Qt.createQmlObject('import QtQuick.Controls 1.0; TextField {}', container, '')
textfield.forceActiveFocus()
textfield.text = "this is my text"
diff --git a/tests/auto/controls/data/tst_toolbar.qml b/tests/auto/controls/data/tst_toolbar.qml
index 97106ff4..fe2c9bd2 100644
--- a/tests/auto/controls/data/tst_toolbar.qml
+++ b/tests/auto/controls/data/tst_toolbar.qml
@@ -55,7 +55,7 @@ TestCase {
height:400
function test_createToolBar() {
- var toolBar = Qt.createQmlObject('import QtQuick.Controls 1.0; ToolBar {}', testCase, '');
+ var toolBar = Qt.createQmlObject('import QtQuick.Controls 1.0; ToolBar {}', container, '');
toolBar.destroy()
}