~mterry/unity8/notify-authenticated

« back to all changes in this revision

Viewing changes to tests/qmltests/Dash/tst_GenericScopeView.qml

  • Committer: Michael Terry
  • Date: 2014-08-21 12:53:29 UTC
  • mfrom: (1161.1.23 unity8)
  • Revision ID: michael.terry@canonical.com-20140821125329-8c14utjip4id3e7m
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
                spy.signalName = "";
77
77
            }
78
78
 
 
79
            function scrollToCategory(category) {
 
80
                var categoryListView = findChild(genericScopeView, "categoryListView");
 
81
                tryCompareFunction(function() {
 
82
                    if (findChild(genericScopeView, category)) return true;
 
83
                    mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
 
84
                               genericScopeView.width/2, genericScopeView.y)
 
85
                    tryCompare(categoryListView, "moving", false);
 
86
                    return findChild(genericScopeView, category) !== null;
 
87
                }, true);
 
88
 
 
89
                tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
 
90
                return findChild(genericScopeView, category);
 
91
            }
 
92
 
79
93
            function test_isActive() {
80
94
                tryCompare(genericScopeView.scope, "isActive", false)
81
95
                genericScopeView.isCurrent = true
222
236
            }
223
237
 
224
238
            function test_forced_category_expansion() {
225
 
                tryCompareFunction(function() {
226
 
                    mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
227
 
                               genericScopeView.width/2, genericScopeView.y)
228
 
                    return findChild(genericScopeView, "dashCategory19") !== null;
229
 
                }, true);
230
 
                var category = findChild(genericScopeView, "dashCategory19")
 
239
                var category = scrollToCategory("dashCategory19");
231
240
                compare(category.expandable, false, "Category with collapsed-rows: 0 should not be expandable");
232
241
 
233
242
                var grid = findChild(category, "19");
285
294
            }
286
295
 
287
296
            function test_showPreviewCarousel() {
288
 
                tryCompareFunction(function() {
289
 
                                        var dashCategory1 = findChild(genericScopeView, "dashCategory1");
290
 
                                        if (dashCategory1 != null) {
291
 
                                            var tile = findChild(dashCategory1, "carouselDelegate1");
292
 
                                            return tile != null;
293
 
                                        }
294
 
                                        return false;
295
 
                                    },
296
 
                                    true);
 
297
                var category = scrollToCategory("dashCategory1");
297
298
 
298
299
                tryCompare(testCase.previewListView, "open", false);
299
300
 
300
 
                var dashCategory1 = findChild(genericScopeView, "dashCategory1");
301
 
                var tile = findChild(dashCategory1, "carouselDelegate1");
 
301
                var tile = findChild(category, "carouselDelegate1");
 
302
                verify(tile, "Could not find delegate");
 
303
 
302
304
                mouseClick(tile, tile.width / 2, tile.height / 2);
303
305
                tryCompare(tile, "explicitlyScaled", true);
304
306
                mouseClick(tile, tile.width / 2, tile.height / 2);
306
308
                tryCompare(testCase.previewListView, "x", 0);
307
309
 
308
310
                closePreview();
 
311
 
 
312
                mousePress(tile, tile.width / 2, tile.height / 2);
 
313
                tryCompare(testCase.previewListView, "open", true);
 
314
                tryCompare(testCase.previewListView, "x", 0);
 
315
                mouseRelease(tile, tile.width / 2, tile.height / 2);
 
316
 
 
317
                closePreview();
 
318
            }
 
319
 
 
320
            function test_showPreviewHorizontalList() {
 
321
                var category = scrollToCategory("dashCategory18");
 
322
 
 
323
                tryCompare(testCase.previewListView, "open", false);
 
324
 
 
325
                var tile = findChild(category, "delegate1");
 
326
                verify(tile, "Could not find delegate");
 
327
 
 
328
                mouseClick(tile, tile.width / 2, tile.height / 2);
 
329
                tryCompare(testCase.previewListView, "open", true);
 
330
                tryCompare(testCase.previewListView, "x", 0);
 
331
 
 
332
                closePreview();
 
333
 
 
334
                mousePress(tile, tile.width / 2, tile.height / 2);
 
335
                tryCompare(testCase.previewListView, "open", true);
 
336
                tryCompare(testCase.previewListView, "x", 0);
 
337
                mouseRelease(tile, tile.width / 2, tile.height / 2);
 
338
 
 
339
                closePreview();
309
340
            }
310
341
 
311
342
            function test_previewCycle() {
333
364
 
334
365
            function test_header_style_data() {
335
366
                return [
336
 
                    { tag: "Default", index: 0, foreground: "grey", background: "", logo: "" },
 
367
                    { tag: "Default", index: 0, foreground: Theme.palette.normal.baseText, background: "", logo: "" },
337
368
                    { tag: "Foreground", index: 1, foreground: "yellow", background: "", logo: "" },
338
 
                    { tag: "Logo+Background", index: 2, foreground: "grey", background: "gradient:///lightgrey/grey",
339
 
                      logo: Qt.resolvedUrl("../Components/tst_PageHeader/logo-ubuntu-orange.svg") },
 
369
                    { tag: "Logo+Background", index: 2, foreground: Theme.palette.normal.baseText, background: "gradient:///lightgrey/grey",
 
370
                      logo: Qt.resolvedUrl("../Dash/tst_PageHeader/logo-ubuntu-orange.svg") },
340
371
                ];
341
372
            }
342
373