on xenial help sign in
Other approach to test
5a4d240Andrea Cimitan
tests/qmltests/Dash/ScopeSettings/tst_ScopeSettingList.qml+9−8
@@ -33,6 +33,11 @@ Rectangle {
33 ScopeSettingList {
33 ScopeSettingList {
34 id: scopeSetting
34 id: scopeSetting
35 width: parent.width
35 width: parent.width
36+ widgetData: settingData
37+ }
38+
39+ ScopeSettingList {
40+ id: scopeSettingFresh
36 initialValue: 2
41 initialValue: 2
37 }
42 }
38
43
@@ -49,19 +54,15 @@ Rectangle {
49
54
50 property var control: findChild(scopeSetting, "control")
55 property var control: findChild(scopeSetting, "control")
51
56
52− function initTestCase() {
53− scopeSetting.widgetData = settingData;
54− }
55−
56 function cleanup() {
57 function cleanup() {
57 control.selectedIndex = 0;
58 control.selectedIndex = 0;
58 spy.clear();
59 spy.clear();
59 }
60 }
60
61
61− function test_0initialValue() {
62+ function test_initialValue() {
62− // this works because is the first test to run
63+ var controlFresh = findChild(scopeSettingFresh, "control");
64+ scopeSettingFresh.widgetData = settingData;
63− tryCompare(control, "selectedIndex", 2);
65+ tryCompare(controlFresh, "selectedIndex", 2);
64− scopeSetting.initialValue = -1;
65 }
66 }
66
67
67 function test_updated_data() {
68 function test_updated_data() {