diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-05-09 16:44:08 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-05-10 16:19:57 +0000 |
commit | 6c2a24a4f2695ae5565b9a5a42b04c9b68833866 (patch) | |
tree | 5373f36a6d5c54ce6c2caf386113142ed5e9fa89 /tests | |
parent | 9947c815ea54c781bc1a9c95e26e2af1e6eebb87 (diff) |
Make QQuickIcon a value type
QQuickIcon no longer inherits QObject, but becomes a light-weight
implicitly shared Q_GADGET-type, that is passed by value the same
way fonts and colors are.
Before:
SUB: OS: Fedora 25 (Workstation Edition)
SUB: QPA: xcb
SUB: GL_VENDOR: Intel Open Source Technology Center
SUB: GL_RENDERER: Mesa DRI Intel(R) Haswell Desktop
SUB: GL_VERSION: 3.0 Mesa 13.0.4
SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml
SUB: 110 frames
SUB: 109 frames
SUB: 109 frames
SUB: 109 frames
SUB: 109 frames
SUB: Average:
SUB: 109.2 frames; using samples; MedianAll=109; StdDev=0.447214, CoV=0.00409536
After:
[...]
SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml
SUB: 123 frames
SUB: 124 frames
SUB: 124 frames
SUB: 122 frames
SUB: 125 frames
SUB: Average:
SUB: 123.6 frames; using samples; MedianAll=124; StdDev=1.14018, CoV=0.00922472
Change-Id: I604532204fb94fc0726d0c9b8b6097f9ebc265e8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_abstractbutton.qml | 26 | ||||
-rw-r--r-- | tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp | 4 |
2 files changed, 9 insertions, 21 deletions
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml index 8ab91e3a..d38adb0a 100644 --- a/tests/auto/controls/data/tst_abstractbutton.qml +++ b/tests/auto/controls/data/tst_abstractbutton.qml @@ -174,40 +174,28 @@ TestCase { compare(control.icon.height, 0) compare(control.icon.color, "#00000000") - var iconNameSpy = signalSpy.createObject(control, { target: control.icon, signalName: "nameChanged"} ) - verify(iconNameSpy.valid) + var iconSpy = signalSpy.createObject(control, { target: control, signalName: "iconChanged"} ) + verify(iconSpy.valid) control.icon.name = "test-name" compare(control.icon.name, "test-name") - compare(iconNameSpy.count, 1) - - var iconSourceSpy = signalSpy.createObject(control, { target: control.icon, signalName: "sourceChanged"} ) - verify(iconSourceSpy.valid) + compare(iconSpy.count, 1) control.icon.source = "qrc:/test-source" compare(control.icon.source, "qrc:/test-source") - compare(iconSourceSpy.count, 1) - - var iconWidthSpy = signalSpy.createObject(control, { target: control.icon, signalName: "widthChanged"} ) - verify(iconWidthSpy.valid) + compare(iconSpy.count, 2) control.icon.width = 32 compare(control.icon.width, 32) - compare(iconWidthSpy.count, 1) - - var iconHeightSpy = signalSpy.createObject(control, { target: control.icon, signalName: "heightChanged"} ) - verify(iconHeightSpy.valid) + compare(iconSpy.count, 3) control.icon.height = 32 compare(control.icon.height, 32) - compare(iconHeightSpy.count, 1) - - var iconColorSpy = signalSpy.createObject(control, { target: control.icon, signalName: "colorChanged"} ) - verify(iconColorSpy.valid) + compare(iconSpy.count, 4) control.icon.color = "#ff0000" compare(control.icon.color, "#ff0000") - compare(iconColorSpy.count, 1) + compare(iconSpy.count, 5) } Component { diff --git a/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp b/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp index 9e7c6794..e311b8ac 100644 --- a/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp +++ b/tests/auto/qquickiconlabel/tst_qquickiconlabel.cpp @@ -240,7 +240,7 @@ void tst_qquickiconlabel::spacingWithOneDelegate() QQuickIconLabel *label = rootItem->findChild<QQuickIconLabel *>(); QVERIFY(label); QQuickItem *delegate = nullptr; - if (label->icon()) { + if (!label->icon().isEmpty()) { QVERIFY(!label->findChild<QQuickText *>()); delegate = label->findChild<QQuickIconImage *>(); } else { @@ -285,7 +285,7 @@ void tst_qquickiconlabel::emptyIconSource() label->setWidth(label->implicitWidth() + 200); label->setHeight(label->implicitWidth() + 100); QVERIFY(icon->property("source").isValid()); - label->icon()->setSource(QString()); + label->setIcon(QQuickIcon()); QVERIFY(!label->findChild<QQuickIconImage *>()); horizontalCenter = label->width() / 2; QCOMPARE(text->x(), horizontalCenter - text->width() / 2); |