~paulliu/unity8/lp1350891_ScrollBackground

« back to all changes in this revision

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

  • Committer: Ying-Chun Liu
  • Date: 2015-02-13 13:27:19 UTC
  • mfrom: (1431.1.180 unity8)
  • Revision ID: paul.liu@canonical.com-20150213132719-8itxhrauv317p18p
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import QtQuick 2.0
18
18
import QtTest 1.0
19
19
import Ubuntu.Components 0.1
20
 
import Ubuntu.Connectivity 1.0
21
20
import Unity.Test 0.1 as UT
22
21
import "../../../qml/Dash"
23
22
import "CardHelpers.js" as Helpers
61
60
            "layout": { "components": Helpers.update(JSON.parse(Helpers.fullMapping), { "art": { "aspect-ratio": 0.7 } }) }
62
61
        },
63
62
        {
64
 
            "name": "Art, header, summary - horizontal",
65
 
            "layout": { "template": { "card-layout": "horizontal" },
 
63
            "name": "Art, header, summary, background - horizontal",
 
64
            "layout": { "template": { "card-layout": "horizontal", "card-background": { "type": "gradient", "elements": ["grey", "white"] } },
66
65
                        "components": JSON.parse(Helpers.fullMapping) }
67
66
        },
68
67
        {
102
101
            "layout": { "template": { "overlay": true },
103
102
                        "components": { "art": "art", "title": "title" } }
104
103
        },
 
104
        {
 
105
            "name": "Art, header, summary - horizontal",
 
106
            "layout": { "template": { "card-layout": "horizontal" },
 
107
                        "components": JSON.parse(Helpers.fullMapping) }
 
108
        },
105
109
    ]
106
110
 
107
111
    CardTool {
221
225
 
222
226
        function init() {
223
227
            loader.visible = true;
224
 
            NetworkingStatus.limitedBandwith = false;
225
228
        }
226
229
 
227
230
        function cleanup() {
409
412
            return [
410
413
                { tag: "Art and summary", visible: true, color: "#ffffff", index: 0 },
411
414
                { tag: "No Summary", visible: false, index: 6 },
412
 
                { tag: "Horizontal", visible: false, index: 5 },
 
415
                { tag: "Horizontal", visible: true, color: "#808080", index: 5 },
413
416
                { tag: "Grey background", visible: true, color: "#808080", index: 10 },
414
417
                { tag: "Overriden Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff",
415
418
                  background: {type: "color", elements: ["grey", "white"]}, index: 10 },
417
420
                  background: Qt.resolvedUrl("artwork/checkers.png"), index: 10 },
418
421
                { tag: "Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff", index: 11 },
419
422
                { tag: "Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"), index: 12 },
 
423
                { tag: "Horizontal no background", visible: false, index: 14 },
420
424
            ];
421
425
        }
422
426
 
541
545
            var touchdown = findChild(card, "touchdown");
542
546
 
543
547
            compare(touchdown.visible, false);
544
 
            mousePress(card, card.width/2, card.height/2);
 
548
            mousePress(card);
545
549
            compare(touchdown.visible, true);
546
 
            mouseRelease(card, card.width/2, card.height/2);
 
550
            mouseRelease(card);
547
551
            compare(touchdown.visible, false);
548
552
        }
549
553
 
585
589
                verify((card.width - titleToCard.x - titleToCard.width) === units.gu(1));
586
590
            }
587
591
        }
588
 
 
589
 
        function test_load_images_visibility_network_data() {
590
 
            return [
591
 
                { tag: "Visible, network", visible: true, limitedBandwith: false },
592
 
                { tag: "Visible, no network", visible: true, limitedBandwith: true },
593
 
                { tag: "Not Visible, network", visible: false, limitedBandwith: false },
594
 
                { tag: "Not Visible, no network", visible: false, limitedBandwith: true }
595
 
            ];
596
 
        }
597
 
 
598
 
        function test_load_images_visibility_network(data) {
599
 
            loader.visible = data.visible;
600
 
            NetworkingStatus.limitedBandwith = data.limitedBandwith;
601
 
 
602
 
            selector.selectedIndex = 0;
603
 
            waitForRendering(selector);
604
 
            waitForRendering(card);
605
 
 
606
 
            verify(data.visible || !data.limitedBandwith || artImage.source == "");
607
 
        }
608
592
    }
609
593
}