aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickcanvasitem
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2021-07-13 11:24:08 +0200
committerAndy Shaw <andy.shaw@qt.io>2021-07-14 08:58:38 +0200
commitc31638f16b1fe709dd9df232afb9ab7fac3b231e (patch)
tree50b16cd4c38d28b6616e7f9ba50bf2b5f01e928a /tests/auto/quick/qquickcanvasitem
parent13d86a3c4e18c4792f246fb2972a5ffe738af65a (diff)
When setting the line dash to be an empty array reset the style to Solid
An empty line dash array is indicating that it should be reset to be a Solid line, otherwise it ends up reusing the previous settings for the pen instead of drawing a solid line. Fixes: QTBUG-75553 Pick-to: 6.2 6.1 5.15 Change-Id: I16466672de95da8ef0cf3fc261969e7cc6add227 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickcanvasitem')
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_line.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_line.qml b/tests/auto/quick/qquickcanvasitem/data/tst_line.qml
index dc960a24d0..fb4db5ae54 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_line.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_line.qml
@@ -894,6 +894,37 @@ CanvasTestCase {
comparePixel(ctx, 39,0, 0,0,0,0);
}
+ function test_lineDashReset(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.strokeStyle = "#ff0000";
+ ctx.lineWidth = 2;
+ var pattern = [2, 3, 5, 1, 6, 3]
+ ctx.setLineDash(pattern)
+
+ compare(ctx.getLineDash(), pattern);
+
+ pattern = []
+ ctx.setLineDash(pattern)
+ compare(ctx.getLineDash(), pattern);
+
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(40, 0);
+ ctx.stroke();
+
+ comparePixel(ctx, 0,0, 255,0,0,255);
+ comparePixel(ctx, 4,0, 255,0,0,255);
+ comparePixel(ctx, 5,0, 255,0,0,255);
+ comparePixel(ctx, 14,0, 255,0,0,255);
+ comparePixel(ctx, 20,0, 255,0,0,255);
+ comparePixel(ctx, 21,0, 255,0,0,255);
+ comparePixel(ctx, 22,0, 255,0,0,255);
+ comparePixel(ctx, 34,0, 255,0,0,255);
+ comparePixel(ctx, 35,0, 255,0,0,255);
+ }
+
function test_lineDashOffset(row) {
var canvas = createCanvasObject(row);
var ctx = canvas.getContext('2d');