~tpeeters/unity8/new_tabbar-again

« back to all changes in this revision

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

  • Committer: tim.peeters at canonical
  • Date: 2014-04-29 14:01:36 UTC
  • mfrom: (832.1.22 unity8)
  • Revision ID: tim.peeters@canonical.com-20140429140136-8idik0b1951bzoqc
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
182
182
        when: windowShown
183
183
 
184
184
        property Item header: findChild(card, "cardHeader")
 
185
        property Item headerLoader: findChild(card, "cardHeaderLoader")
185
186
        property Item title: findChild(header, "titleLabel")
186
187
        property Item art: findChild(card, "artShape")
187
188
        property Item artImage: findChild(card, "artImage")
188
189
        property Item summary: findChild(card, "summaryLabel")
189
190
        property Item background: findChild(card, "background")
 
191
        property Item backgroundLoader: findChild(card, "backgroundLoader")
190
192
        property Item backgroundImage: findChild(card, "backgroundImage")
191
193
 
192
194
        function initTestCase() {
244
246
                { tag: "Wide", width: units.gu(18.5), aspect: 0.5, index: 0 },
245
247
                { tag: "Horizontal", width: units.gu(38), index: 5 },
246
248
                // Make sure card ends with header when there's no summary
247
 
                { tag: "NoSummary", height: function() { return header.y + header.height }, index: 6 },
248
 
                { tag: "HorizontalNoSummary", height: function() { return header.height }, card_layout: "horizontal", index: 6 },
 
249
                { tag: "NoSummary", height: function() { return headerLoader.y + headerLoader.height }, index: 6 },
 
250
                { tag: "HorizontalNoSummary", height: function() { return headerLoader.height }, card_layout: "horizontal", index: 6 },
249
251
            ]
250
252
        }
251
253
 
288
290
                { tag: "Fit", height: units.gu(38), size: "large", width: units.gu(19), index: 4 },
289
291
                { tag: "VerticalWidth", width: function() { return header.width }, index: 0 },
290
292
                { tag: "HorizontalHeight", height: function() { return header.height }, index: 5 },
291
 
                { tag: "HorizontalWidth", width: function() { return header.x }, index: 5 },
 
293
                { tag: "HorizontalWidth", width: function() { return headerLoader.x }, index: 5 },
292
294
            ]
293
295
        }
294
296
 
332
334
        function test_art_layout(data) {
333
335
            selector.selectedIndex = data.index;
334
336
 
335
 
            tryCompare(testCase.header, "x", data.left());
 
337
            tryCompare(testCase.headerLoader, "x", data.left());
336
338
        }
337
339
 
338
340
        function test_header_layout_data() {
349
351
        function test_header_layout(data) {
350
352
            selector.selectedIndex = data.index;
351
353
 
352
 
            tryCompareFunction(function() { return testCase.header.y === data.top() }, true);
353
 
            tryCompareFunction(function() { return testCase.header.x === data.left() }, true);
 
354
            tryCompareFunction(function() { return testCase.headerLoader.y === data.top() }, true);
 
355
            tryCompareFunction(function() { return testCase.headerLoader.x === data.left() }, true);
354
356
        }
355
357
 
356
358
        function test_summary_layout_data() {
357
359
            return [
358
 
                { tag: "With header", top: function() { return header.y + header.height }, index: 0 },
 
360
                { tag: "With header", top: function() { return headerLoader.y + headerLoader.height }, index: 0 },
359
361
                { tag: "Without header", top: function() { return art.y + art.height }, index: 7 },
360
362
            ]
361
363
        }
400
402
 
401
403
            waitForRendering(card);
402
404
 
403
 
            tryCompare(background, "visible", data.visible);
 
405
            tryCompare(backgroundLoader, "active", data.visible);
404
406
 
405
407
            if (data.hasOwnProperty("color")) {
406
408
                tryCompare(background, "color", data.color);
467
469
        function test_mascotShape(data) {
468
470
            selector.selectedIndex = data.index;
469
471
 
470
 
            var shape = findChild(card, "mascotShape");
 
472
            var shape = findChild(card, "mascotShapeLoader");
471
473
            var image = findChild(card, "mascotImage");
472
474
 
473
475
            verify(shape, "Could not find shape.");
474
476
            verify(image, "Could not find image.");
475
477
 
476
 
            tryCompare(shape, "visible", data.shape);
 
478
            tryCompare(shape, "active", data.shape);
477
479
            tryCompare(image, "visible", !data.shape);
478
480
        }
479
481
    }