diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-11-04 14:25:29 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-11-06 17:48:12 +0000 |
commit | dbc2a90b24cd8dcfd58a9f571981e38761a3bf3b (patch) | |
tree | 8bf7ea670bfc032bc4f7a1c59c2a0d9702e4973f /tests/auto/controls/data/tst_radiobutton.qml | |
parent | 954eb6121ff149dc14a17328990c8ad1a5fc7190 (diff) |
Repurpose ExclusiveGroup to ButtonGroup
This is another way of solving the naming clash with Qt Quick Controls,
and narrows our focus to the types of controls that actually make sense
to have in an "exclusive" group; buttons (Android calls them
"selection controls").
Change-Id: Icf6efe583fe784c3594de8635be84bbf757a55cd
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls/data/tst_radiobutton.qml')
-rw-r--r-- | tests/auto/controls/data/tst_radiobutton.qml | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/tests/auto/controls/data/tst_radiobutton.qml b/tests/auto/controls/data/tst_radiobutton.qml index 2df3542d..df6834fe 100644 --- a/tests/auto/controls/data/tst_radiobutton.qml +++ b/tests/auto/controls/data/tst_radiobutton.qml @@ -235,9 +235,13 @@ TestCase { // explicitly grouped buttons are only exclusive with each other, not with // auto-exclusive buttons, and the autoExclusive property is ignored - ExclusiveGroup { id: eg } - RadioButton { ExclusiveGroup.group: eg } - RadioButton { ExclusiveGroup.group: eg; autoExclusive: false } + ButtonGroup { id: eg } + RadioButton { ButtonGroup.group: eg } + RadioButton { ButtonGroup.group: eg; autoExclusive: false } + + ButtonGroup { id: eg2 } + RadioButton { id: rb1; Component.onCompleted: eg2.addButton(rb1) } + RadioButton { id: rb2; Component.onCompleted: eg2.addButton(rb2) } // non-exclusive buttons don't affect the others RadioButton { autoExclusive: false } @@ -247,48 +251,59 @@ TestCase { function test_autoExclusive() { var container = radioButtonGroup.createObject(testCase) - compare(container.children.length, 6) + compare(container.children.length, 8) - var checkStates = [false, false, false, false, false, false] - for (var i = 0; i < 6; ++i) + var checkStates = [false, false, false, false, false, false, false, false] + for (var i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[0].checked = true checkStates[0] = true - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[1].checked = true checkStates[0] = false checkStates[1] = true - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[2].checked = true checkStates[2] = true - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[3].checked = true checkStates[2] = false checkStates[3] = true - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[4].checked = true checkStates[4] = true - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[5].checked = true + checkStates[4] = false checkStates[5] = true - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) + compare(container.children[i].checked, checkStates[i]) + + container.children[6].checked = true + checkStates[6] = true + for (i = 0; i < 8; ++i) + compare(container.children[i].checked, checkStates[i]) + + container.children[7].checked = true + checkStates[7] = true + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.children[0].checked = true checkStates[0] = true checkStates[1] = false - for (i = 0; i < 6; ++i) + for (i = 0; i < 8; ++i) compare(container.children[i].checked, checkStates[i]) container.destroy() |