on xenial help sign in
test fixes for removal of content activator
commitcfa89fb76efe64cb587405783d3efcd75df47573 authorNick Dedekind <nick.dedekind@canonical.com> dateTue 9 Sep 2014, 16:10 (12 years ago) parent2a84c00
3 files changed+21−82
tests/mocks/Unity/Indicators/FakeMenuPage.qml−10 tests/qmltests/Panel/Indicators/tst_MessageMenuItemFactory.qml+21−30 tests/qmltests/Panel/tst_MenuContent.qml−42
tests/mocks/Unity/Indicators/FakeMenuPage.qml−10
@@ -19,16 +19,6 @@ import QtQuick 2.0
1919Flickable {
2020 objectName: "fakeMenuPlugin"
2121 // Make it compatible with the PluginItem interface
22− function start() {
23− if (shell != undefined && shell.indicator_status != undefined) {
24− shell.indicator_status[objectName].started = true;
25− }
26− }
27− function stop() {
28− if (shell != undefined && shell.indicator_status != undefined) {
29− shell.indicator_status[objectName].started = false;
30− }
31− }
3222 function reset() {
3323 if (shell != undefined && shell.indicator_status != undefined) {
3424 shell.indicator_status[objectName].reset++;
tests/qmltests/Panel/Indicators/tst_MessageMenuItemFactory.qml+21−30
@@ -90,16 +90,13 @@ Item {
9090 factory.menuData = menuData;
9191 timeFormatter.time = data.time.getTime()/1000;
9292
93− var loader = findChild(factory, "loader");
94− verify(loader !== undefined);
95−
96− tryCompare(loader.item, "objectName", "simpleTextMessage");
97− compare(loader.item.title, data.title, "Title does not match data");
98− compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
99− compare(loader.item.body, data.body, "Message does not match data");
100− compare(loader.item.avatar, data.avatar, "Avatar does not match data");
101− compare(loader.item.icon, data.icon, "App icon does not match data");
102− compare(loader.item.enabled, data.enabled, "Enabled does not match data");
93+ tryCompare(factory.item, "objectName", "simpleTextMessage");
94+ compare(factory.item.title, data.title, "Title does not match data");
95+ compare(factory.item.time, timeFormatter.timeString, "Time does not match data");
96+ compare(factory.item.body, data.body, "Message does not match data");
97+ compare(factory.item.avatar, data.avatar, "Avatar does not match data");
98+ compare(factory.item.icon, data.icon, "App icon does not match data");
99+ compare(factory.item.enabled, data.enabled, "Enabled does not match data");
103100 }
104101
105102 function test_create_textmessage_data() {
@@ -128,16 +125,13 @@ Item {
128125 factory.menuData = menuData;
129126 timeFormatter.time = data.time.getTime()/1000;
130127
131− var loader = findChild(factory, "loader");
132− verify(loader !== undefined);
133−
134− tryCompare(loader.item, "objectName", "textMessage");
135− compare(loader.item.title, data.title, "Title does not match data");
136− compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
137− compare(loader.item.body, data.body, "Message does not match data");
138− compare(loader.item.avatar, data.avatar, "Avatar does not match data");
139− compare(loader.item.icon, data.icon, "App icon does not match data");
140− compare(loader.item.enabled, data.enabled, "Enabled does not match data");
128+ tryCompare(factory.item, "objectName", "textMessage");
129+ compare(factory.item.title, data.title, "Title does not match data");
130+ compare(factory.item.time, timeFormatter.timeString, "Time does not match data");
131+ compare(factory.item.body, data.body, "Message does not match data");
132+ compare(factory.item.avatar, data.avatar, "Avatar does not match data");
133+ compare(factory.item.icon, data.icon, "App icon does not match data");
134+ compare(factory.item.enabled, data.enabled, "Enabled does not match data");
141135 }
142136
143137
@@ -170,16 +164,13 @@ Item {
170164 factory.menuData = menuData;
171165 timeFormatter.time = data.time.getTime()/1000;
172166
173− var loader = findChild(factory, "loader");
174− verify(loader !== undefined);
175−
176− tryCompare(loader.item, "objectName", "snapDecision");
177− compare(loader.item.title, data.title, "Title does not match data");
178− compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
179− compare(loader.item.body, data.body, "Message does not match data");
180− compare(loader.item.avatar, data.avatar, "Avatar does not match data");
181− compare(loader.item.icon, data.icon, "App icon does not match data");
182− compare(loader.item.enabled, data.enabled, "Enabled does not match data");
167+ tryCompare(factory.item, "objectName", "snapDecision");
168+ compare(factory.item.title, data.title, "Title does not match data");
169+ compare(factory.item.time, timeFormatter.timeString, "Time does not match data");
170+ compare(factory.item.body, data.body, "Message does not match data");
171+ compare(factory.item.avatar, data.avatar, "Avatar does not match data");
172+ compare(factory.item.icon, data.icon, "App icon does not match data");
173+ compare(factory.item.enabled, data.enabled, "Enabled does not match data");
183174 }
184175
185176 }
tests/qmltests/Panel/tst_MenuContent.qml−42
@@ -47,7 +47,6 @@ Item {
4747 MenuContent {
4848 id: menuContent
4949 indicatorsModel: indicatorsModel
50− contentReleaseInterval: 50
5150 height: parent.height - 50
5251 }
5352
@@ -114,12 +113,6 @@ Item {
114113 name: "MenuContentTest"
115114 when: windowShown
116115
117− function init() {
118− if (menuContent.__contentActive)
119− menuContent.releaseContent();
120− tryCompare(menuContent, "__contentActive", false);
121− }
122−
123116 // Check that the correct menus are displayed for the requested item.
124117 function test_show_menu() {
125118 var menuCount = indicatorsModel.count;
@@ -139,41 +132,6 @@ Item {
139132 }
140133 }
141134
142− // Calling activateContent should call start on all menus
143− function test_activate_content() {
144− var menuCount = indicatorsModel.count;
145− verify(menuCount > 0, "Menu count should be greater than zero");
146−
147− // Ensure all the menus are stopped first
148− menuContent.__contentActive = false;
149− for (var i = 0; i < menuCount; i++) {
150− tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
151− }
152−
153− // activate content the content to call stop.
154− menuContent.activateContent();
155− for (var i = 0; i < menuCount; i++) {
156− tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
157− }
158− }
159−
160− // Calling activateContent should call stop on all menus.
161− function test_release_content() {
162− var menuCount = indicatorsModel.count;
163− verify(menuCount > 0, "Menu count should be greater than zero");
164−
165− // Ensure all the menus are started first
166− menuContent.__contentActive = true;
167− for (var i = 0; i < menuCount; i++) {
168− tryCompare(indicator_status[get_test_menu_objecName(i)], "started", true);
169− }
170− // release the content to call stop.
171− menuContent.releaseContent();
172− for (var i = 0; i < menuCount; i++) {
173− tryCompare(indicator_status[get_test_menu_objecName(i)], "started", false);
174− }
175− }
176−
177135 // Tests QTBUG-30632 - asynchronous loader crashes when changing index quickly.
178136 function test_multi_activate() {
179137 var menuCount = indicatorsModel.count;