aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklayouts
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@theqtcompany.com>2016-03-01 12:31:28 +0100
committerJan Arve Sæther <jan-arve.saether@theqtcompany.com>2016-03-02 14:13:18 +0000
commitba1491488e02dfb4de734b4f2755c4899db0a815 (patch)
tree8f5aeafae78bfc863af3666cd72411bd4255ef98 /tests/auto/quick/qquicklayouts
parentdf16c819cb4ee096a38c8c013cbb26a0ca561432 (diff)
Add more tests for pixel snapping of sizes
Task-number: QTBUG-41216 Change-Id: I4456709ec5c4e61183fb4056a5f6d6bd9bd863d5 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquicklayouts')
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 64a54830f9..33b8fd0e4e 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -706,6 +706,33 @@ Item {
/*expected: [90, 90, 90]*/ }, /* verify that nothing gets allocated a size larger than its maximum */
{ tag: "fixedSizeHasFractions", spacing: 2, width: 31 + 4, hints: [{min: 10+1/3, max: 10+1/3}, {min: 10+1/3, max: 10+1/3}, {min: 10+1/3, max: 10+1/3}],
/*expected: [11, 11, 11]*/ }, /* verify that nothing gets allocated a size smaller than its minimum */
+ { tag: "481", spacing: 0, width: 481,
+ hints: [{min:0, pref:0, max:999}, {min:0, pref:0, max: 999}, {min: 0, pref: 0, max:0}],
+ expected: [241, 240, 0] },
+ { tag: "theend", spacing: 1, width: 18,
+ hints: [{min: 10, pref: 10, max:10}, {min:3, pref:3.33}, {min:2, pref:2.33}],
+ expected: [10, 4, 2] },
+ { tag: "theend2", spacing: 1, width: 18,
+ hints: [{min: 10, pref: 10, max:10}, {min:3, pref:3.33}, {min:2.33, pref:2.33}],
+ expected: [10, 3, 3] },
+ { tag: "43", spacing: 0, width: 43,
+ hints: [{min: 10, pref: 10, max:10}, {min:10, pref:30.33}, {min:2.33, pref:2.33}],
+ expected: [10, 30, 3] },
+ { tag: "40", spacing: 0, width: 40,
+ hints: [{min: 10, pref: 10, max:10}, {min:10, pref:30.33}, {min:2.33, pref:2.33}],
+ expected: [10, 27, 3] },
+ { tag: "roundingAccumulates1", spacing: 0, width: 50,
+ hints: [{pref: 10, max:30.3},
+ {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3},
+ {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3},
+ {pref: 10, max:30.3}],
+ expected: [10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 10] },
+ { tag: "roundingAccumulates2", spacing: 0, width: 60,
+ hints: [{pref: 20, max:30.3},
+ {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3},
+ {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3}, {min:2.3, pref:2.3},
+ {pref: 20, max:30.3}],
+ expected: [15, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15] },
];
}
@@ -738,6 +765,10 @@ Item {
// TEST
for (i = 0; i < n; ++i) {
compare(kids[i].x % 1, 0) // checks if position is a whole integer
+ // check if width is a whole integer (unless there are constraints preventing it from stretching)
+ verify(kids[i].width % 1 == 0
+ || Math.floor(kids[i].Layout.maximumWidth) < kids[i].width
+ || layout.width < layout.Layout.maximumWidth + 1)
// verify if the items are within the size constraints as specified
verify(kids[i].width >= kids[i].Layout.minimumWidth)
verify(kids[i].width <= kids[i].Layout.maximumWidth)