aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickrectangle
diff options
context:
space:
mode:
authorSanttu Lakkala <santtu.lakkala@nomovok.com>2015-05-29 18:40:56 +0300
committerGunnar Sletta <gunnar@sletta.org>2015-06-17 08:01:06 +0000
commit10ce105b25a03fbde1889ea767985d5009658a1d (patch)
treeb50447f3dd6bbe0cd2621c019735f709bbf82fc3 /tests/auto/quick/qquickrectangle
parent96336ab0effa9a659b4a35718635fe88b10ba6fc (diff)
QSGDefaultRectangleNode: Fix gradient position calculations
Change the gradient position calculations to consider full border, not just half of it, because the border is fully drawn inside the rectangle, not half outside, half inside. Task-number: QTBUG-36059 Change-Id: Ie7dec94d9f6e03ae07c612c6e3b1950781973dc7 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests/auto/quick/qquickrectangle')
-rw-r--r--tests/auto/quick/qquickrectangle/data/gradient-border.qml21
-rw-r--r--tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp11
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickrectangle/data/gradient-border.qml b/tests/auto/quick/qquickrectangle/data/gradient-border.qml
new file mode 100644
index 0000000000..1d45fb2799
--- /dev/null
+++ b/tests/auto/quick/qquickrectangle/data/gradient-border.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ Rectangle {
+ width: 100
+ height: 100
+ border.width: 10
+ radius: 10
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.00
+ color: '#ffffff'
+ }
+ GradientStop {
+ position: 0.94
+ color: '#000000'
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
index 8a24636647..a7e82e272f 100644
--- a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
+++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
@@ -35,6 +35,7 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
#include <private/qquickrectangle_p.h>
#include "../../shared/util.h"
@@ -47,6 +48,7 @@ public:
private slots:
void gradient();
+ void gradient_border();
void antialiasing();
private:
@@ -88,6 +90,15 @@ void tst_qquickrectangle::gradient()
delete rect;
}
+void tst_qquickrectangle::gradient_border()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("gradient-border.qml"));
+ view.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+}
+
void tst_qquickrectangle::antialiasing()
{
QQmlComponent component(&engine);