on xenial help sign in
Add test for left/right paddings
commit9de73b24c40d2d11393ccccea293011e22cbd5a2 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateThu 21 Aug 2014, 12:20 (12 years ago) parent7a796ef
1 file changed+44
tests/qmltests/Dash/tst_Card.qml+44
tests/qmltests/Dash/tst_Card.qml+44
@@ -96,6 +96,11 @@ Rectangle {
9696 "layout": { "template": { "card-background": Qt.resolvedUrl("artwork/checkers.png") },
9797 "components": JSON.parse(Helpers.fullMapping) }
9898 },
99+ {
100+ "name": "Art, title - overlaid",
101+ "layout": { "template": { "overlay": true },
102+ "components": { "art": "art", "summary": "summary" } }
103+ },
99104 ]
100105
101106 CardTool {
@@ -505,5 +510,44 @@ Rectangle {
505510 mouseRelease(card, card.width/2, card.height/2);
506511 compare(touchdown.visible, false);
507512 }
513+
514+ function test_apaddings_data() {
515+ return [
516+ { tag: "Art and summary", index: 0 },
517+ { tag: "No Summary", index: 6 },
518+ { tag: "No header", index: 7 },
519+ { tag: "Header only", index: 8 },
520+ { tag: "Art, header, summary - overlaid", index: 9 },
521+ { tag: "Art, title - overlaid", index: 13 },
522+ ];
523+ }
524+
525+ function test_apaddings(data) {
526+ selector.selectedIndex = data.index;
527+ waitForRendering(card);
528+
529+ if (title) var titleToCard = title.mapToItem(card, 0, 0, title.width, title.height);
530+
531+ // left margin
532+ if (mascotImage) {
533+ var mascotToCard = mascotImage.mapToItem(card, 0, 0, mascotImage.width, mascotImage.height);
534+ verify(mascotToCard.x === units.gu(1));
535+ if (title) {
536+ verify((titleToCard.x - mascotToCard.x - mascotToCard.width) === units.gu(1));
537+ }
538+ } else if (title) {
539+ verify(titleToCard.x === units.gu(1));
540+ }
541+
542+ // right margin
543+ var emblemIcon = findChild(card, "emblemIcon");
544+ if (emblemIcon) {
545+ var emblemToCard = emblemIcon.mapToItem(card, 0, 0, emblemIcon.width, emblemIcon.height);
546+ verify((card.width - emblemToCard.x - emblemToCard.width) === units.gu(1));
547+ } else if (title) {
548+ verify((card.width - titleToCard.x - titleToCard.width) === units.gu(1));
549+ }
550+ }
551+
508552 }
509553}