aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2016-02-29 15:56:03 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-04-13 09:07:38 +0000
commit7a8f055c6ee274292f2585f59ff6bac4383d6b01 (patch)
tree4c7b3537d40c8dd50284e21622d36d28db67d501 /tests
parent4ae3a828ad972e24802ea711fc12e12883cc28be (diff)
Expose checkable where necessary, instead of in QQuickAbstractButton
QQuickCheckBox, QQuickRadioButton and QQuickSwitch are inherently checkable, so having this property available to QML doesn't make sense. QQuickButton and QQuickMenuItem are the two classes that need to expose the property. Change-Id: Ic421c195295c4bef0fc934c98fa9e781d98c9b67 Task-number: QTBUG-51554 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_button.qml19
-rw-r--r--tests/auto/controls/data/tst_combobox.qml1
-rw-r--r--tests/auto/controls/data/tst_menuitem.qml19
-rw-r--r--tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml1
-rw-r--r--tests/manual/gifs/tst_gifs.cpp2
5 files changed, 39 insertions, 3 deletions
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index 4127fbf2..978ab3c3 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -231,4 +231,23 @@ TestCase {
compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
+
+ function test_checkable() {
+ var control = button.createObject(testCase)
+ verify(control)
+ verify(control.hasOwnProperty("checkable"))
+ verify(!control.checkable)
+
+ mouseClick(control)
+ verify(!control.checked)
+
+ control.checkable = true
+ mouseClick(control)
+ verify(control.checked)
+
+ mouseClick(control)
+ verify(!control.checked)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index d51f16fb..24df675e 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -641,7 +641,6 @@ TestCase {
width: _combobox.width
text: _combobox.textRole ? (Array.isArray(_combobox.model) ? modelData[_combobox.textRole] : model[_combobox.textRole]) : modelData
objectName: "delegate"
- checkable: true
autoExclusive: true
checked: _combobox.currentIndex === index
highlighted: _combobox.highlightedIndex === index
diff --git a/tests/auto/controls/data/tst_menuitem.qml b/tests/auto/controls/data/tst_menuitem.qml
index 8c9bc71b..7e6818da 100644
--- a/tests/auto/controls/data/tst_menuitem.qml
+++ b/tests/auto/controls/data/tst_menuitem.qml
@@ -61,4 +61,23 @@ TestCase {
compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
+
+ function test_checkable() {
+ var control = menuItem.createObject(testCase)
+ verify(control)
+ verify(control.hasOwnProperty("checkable"))
+ verify(!control.checkable)
+
+ mouseClick(control)
+ verify(!control.checked)
+
+ control.checkable = true
+ mouseClick(control)
+ verify(control.checked)
+
+ mouseClick(control)
+ verify(!control.checked)
+
+ control.destroy()
+ }
}
diff --git a/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml b/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml
index 413cd085..f0c029a6 100644
--- a/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml
+++ b/tests/manual/gifs/data/qtquickcontrols-itemdelegate.qml
@@ -56,7 +56,6 @@ Window {
id: repeater
model: ["Option 1", "Option 2", "Option 3"]
delegate: ItemDelegate {
- checkable: true
text: modelData
}
}
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index 3b9cad02..bcc5b867 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -474,7 +474,7 @@ void tst_Gifs::delegates_data()
QTest::addColumn<QVector<int> >("pressIndices");
QTest::addColumn<int>("duration");
- QTest::newRow("ItemDelegate") << "itemdelegate" << (QVector<int>() << 0 << 0) << 5;
+ QTest::newRow("ItemDelegate") << "itemdelegate" << (QVector<int>() << 0 << 1 << 2) << 5;
QTest::newRow("CheckDelegate") << "checkdelegate" << (QVector<int>() << 0 << 0) << 5;
QTest::newRow("RadioDelegate") << "radiodelegate" << (QVector<int>() << 1 << 0) << 5;
}