aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanchors
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-05-09 11:25:31 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-11 07:22:25 +0200
commit50482f69af0b9392424dfdad5376fcb09be36d46 (patch)
tree5d0cbc6f95d28d03c82e0bf0dc96b4755e7877ce /tests/auto/quick/qquickanchors
parent67fb05034c9758d25464f2103ae6068dbc9bb110 (diff)
Make unaligned centered alignment optional.
Centered alignment was recently made unaligned by e99c5a3f113bbc1b8f8db996b4b0d5715eea2d89. This has the side-effect of sometimes making items appear fuzzy due to sub-pixel alignment. Since we have two conflicting goals, make this behavior configuarable. Change-Id: I5ed0e9532a64f4a986d148044f5871a7ec970f5f Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickanchors')
-rw-r--r--tests/auto/quick/qquickanchors/data/centerin.qml7
-rw-r--r--tests/auto/quick/qquickanchors/data/centerinRotation.qml1
-rw-r--r--tests/auto/quick/qquickanchors/tst_qquickanchors.cpp11
3 files changed, 16 insertions, 3 deletions
diff --git a/tests/auto/quick/qquickanchors/data/centerin.qml b/tests/auto/quick/qquickanchors/data/centerin.qml
index e6c9179116..b880219f0f 100644
--- a/tests/auto/quick/qquickanchors/data/centerin.qml
+++ b/tests/auto/quick/qquickanchors/data/centerin.qml
@@ -15,4 +15,11 @@ Rectangle {
width: 11; height: 11; color: "green"
anchors.centerIn: parent;
}
+
+ Rectangle {
+ objectName: "centered3"
+ width: 11; height: 11; color: "green"
+ anchors.centerIn: parent;
+ anchors.alignWhenCentered: false
+ }
}
diff --git a/tests/auto/quick/qquickanchors/data/centerinRotation.qml b/tests/auto/quick/qquickanchors/data/centerinRotation.qml
index 933a25c100..86d696bca2 100644
--- a/tests/auto/quick/qquickanchors/data/centerinRotation.qml
+++ b/tests/auto/quick/qquickanchors/data/centerinRotation.qml
@@ -7,6 +7,7 @@ Rectangle {
rotation: 90
width: 101; height: 101; color: "blue"
anchors.centerIn: parent;
+ anchors.alignWhenCentered: false
Rectangle {
objectName: "inner"
diff --git a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
index 7b748f6191..544fb4ba12 100644
--- a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
+++ b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
@@ -545,10 +545,15 @@ void tst_qquickanchors::centerIn()
QCOMPARE(rect->x(), 75.0 - 20.0);
QCOMPARE(rect->y(), 75.0 - 10.0);
- //QTBUG-21730 (use actual center to prevent animation jitter)
+ // By default center aligned to pixel
QQuickRectangle* rect2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered2"));
- QCOMPARE(rect2->x(), 94.5);
- QCOMPARE(rect2->y(), 94.5);
+ QCOMPARE(rect2->x(), 94.0);
+ QCOMPARE(rect2->y(), 94.0);
+
+ //QTBUG-21730 (use actual center to prevent animation jitter)
+ QQuickRectangle* rect3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered3"));
+ QCOMPARE(rect3->x(), 94.5);
+ QCOMPARE(rect3->y(), 94.5);
delete view;
}