aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_toolbutton.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-04-11 16:42:12 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-04-11 18:33:32 +0000
commit53a101f35b76ccea0e8a6bd00055259811df41d1 (patch)
treea757b336e9c63ec0d4e8a79c06341c7c33451806 /tests/auto/controls/data/tst_toolbutton.qml
parent4503d45b93721e516e949419f3b9c6b796a7c13e (diff)
QQuickIconLabel: create icon and label items lazily
Before: Average: 120.2 frames; using samples; MedianAll=120; StdDev=0.447214, CoV=0.00372058 After: Average: 129.8 frames; using samples; MedianAll=130; StdDev=0.447214, CoV=0.00344541 Task-number: QTBUG-59746 Change-Id: I44b521688cd60e7e287968828f9d4062cc642a0d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_toolbutton.qml')
-rw-r--r--tests/auto/controls/data/tst_toolbutton.qml38
1 files changed, 17 insertions, 21 deletions
diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml
index 58daf119..ed76db13 100644
--- a/tests/auto/controls/data/tst_toolbutton.qml
+++ b/tests/auto/controls/data/tst_toolbutton.qml
@@ -205,42 +205,38 @@ TestCase {
verify(control)
verify(control.icon.source.length > 0)
- var iconImage = control.contentItem.icon
- verify(iconImage)
- verify(iconImage.hasOwnProperty("name"))
- var label = control.contentItem.label
- verify(label)
- verify(label.hasOwnProperty("text"))
+ var iconImage = findChild(control.contentItem, "image")
+ var textLabel = findChild(control.contentItem, "label")
switch (control.display) {
case ToolButton.IconOnly:
- compare(iconImage.visible, true)
- compare(label.visible, false)
+ verify(iconImage)
+ verify(!textLabel)
compare(iconImage.x, (control.availableWidth - iconImage.width) / 2)
compare(iconImage.y, (control.availableHeight - iconImage.height) / 2)
break;
case ToolButton.TextOnly:
- compare(iconImage.visible, false)
- compare(label.visible, true)
- compare(label.x, (control.availableWidth - label.width) / 2)
- compare(label.y, (control.availableHeight - label.height) / 2)
+ verify(!iconImage)
+ verify(textLabel)
+ compare(textLabel.x, (control.availableWidth - textLabel.width) / 2)
+ compare(textLabel.y, (control.availableHeight - textLabel.height) / 2)
break;
case ToolButton.TextUnderIcon:
- compare(iconImage.visible, true)
- compare(label.visible, true)
+ verify(iconImage)
+ verify(textLabel)
compare(iconImage.x, (control.availableWidth - iconImage.width) / 2)
- compare(label.x, (control.availableWidth - label.width) / 2)
- verify(iconImage.y < label.y)
+ compare(textLabel.x, (control.availableWidth - textLabel.width) / 2)
+ verify(iconImage.y < textLabel.y)
break;
case ToolButton.TextBesideIcon:
- compare(iconImage.visible, true)
- compare(label.visible, true)
+ verify(iconImage)
+ verify(textLabel)
if (control.mirrored)
- verify(label.x < iconImage.x)
+ verify(textLabel.x < iconImage.x)
else
- verify(iconImage.x < label.x)
+ verify(iconImage.x < textLabel.x)
compare(iconImage.y, (control.availableHeight - iconImage.height) / 2)
- compare(label.y, (control.availableHeight - label.height) / 2)
+ compare(textLabel.y, (control.availableHeight - textLabel.height) / 2)
break;
}
}