@@ -0,0 +1,100 @@
2+ * Copyright 2015 Canonical Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+import "../../../../qml/Dash/Filters"
20+import Unity.Test 0.1 as UT
27+ color: Theme.palette.selected.background
29+ property var singleSelectionWidgetData
32+ id: optionsSingleSelect
46+ function setChecked(index, checked) {
47+ for (var i = 0; i < optionsSingleSelect.count; ++i)
48+ optionsSingleSelect.setProperty(i, "checked", false);
49+ optionsSingleSelect.setProperty(index, "checked", checked);
53+ Component.onCompleted: {
54+ singleSelectionWidgetData = { label: "Hola", options: optionsSingleSelect }
57+ FilterWidgetFactory {
59+ widgetId: "testOptionSelectorFilter"
60+ widgetType: Filters.OptionSelectorFilter
61+ widgetData: singleSelectionWidgetData
69+ name: "FilterOptionSelector"
72+ function test_optionSelector() {
73+ var initialHeight = factory.implicitHeight;
74+ var currentHeight = 0;
77+ // wait for it to stop growing
78+ while (currentHeight != factory.implicitHeight) {
79+ currentHeight = factory.implicitHeight;
82+ verify(initialHeight < currentHeight);
84+ // Check the first option
85+ var option0 = findChild(factory, "testOptionSelectorFilterlabel0");
87+ verify(optionsSingleSelect.get(0).checked);
89+ // Check the second option
90+ var option1 = findChild(factory, "testOptionSelectorFilterlabel1");
92+ verify(!optionsSingleSelect.get(0).checked);
93+ verify(optionsSingleSelect.get(1).checked);
95+ // Uncheck the second option
97+ verify(!optionsSingleSelect.get(1).checked);