From 1c834f1d6bfe78ba30f4ee733a65b43029632df9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 28 Mar 2017 16:24:02 +0200 Subject: Add some Lancelot tests for PathItem Change-Id: Ifec23f855d4c3e0c58e59777cf23149ad99a2b91 Reviewed-by: Eirik Aavitsland --- .../data/pathitem/pathitem_arc.qml | 119 +++++++++++++++++++++ .../data/pathitem/pathitem_arc_fill.qml | 119 +++++++++++++++++++++ .../data/pathitem/pathitem_cubic.qml | 36 +++++++ .../data/pathitem/pathitem_linear_gradient.qml | 34 ++++++ .../data/pathitem/pathitem_lines.qml | 109 +++++++++++++++++++ .../data/pathitem/pathitem_quad.qml | 35 ++++++ .../data/pathitem/pathitem_spread.qml | 36 +++++++ 7 files changed, 488 insertions(+) create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc.qml create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc_fill.qml create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_cubic.qml create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_linear_gradient.qml create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_lines.qml create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_quad.qml create mode 100644 tests/manual/scenegraph_lancelot/data/pathitem/pathitem_spread.qml (limited to 'tests') diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc.qml new file mode 100644 index 0000000000..6b714caf51 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc.qml @@ -0,0 +1,119 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + Column { + Item { + width: 200 + height: 100 + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: VisualPath.DashLine + strokeWidth: 4 + + Path { + startX: 4; startY: 4 + PathArc { + id: arc + x: 96; y: 96 + radiusX: 100; radiusY: 100 + direction: model.index === 0 ? PathArc.Clockwise : PathArc.Counterclockwise + } + } + } + } + } + } + + Item { + width: 200 + height: 100 + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: VisualPath.DashLine + strokeWidth: 4 + + Path { + startX: 50; startY: 100 + PathArc { + x: 100; y: 150 + radiusX: 50; radiusY: 50 + useLargeArc: model.index === 1 + } + } + } + } + } + } + + Item { + width: 200 + height: 100 + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: VisualPath.DashLine + strokeWidth: 4 + + Path { + startX: 50; startY: 150 + PathArc { + x: 150; y: 150 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + } + } + } + } + } + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + + Path { + startX: 50; startY: 150 + PathArc { + x: 150; y: 150 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + direction: PathArc.Counterclockwise + } + } + } + } + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc_fill.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc_fill.qml new file mode 100644 index 0000000000..b1e1ed741b --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_arc_fill.qml @@ -0,0 +1,119 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + Column { + Item { + width: 200 + height: 100 + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "lightBlue" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: VisualPath.DashLine + strokeWidth: 4 + + Path { + startX: 4; startY: 4 + PathArc { + id: arc + x: 96; y: 96 + radiusX: 100; radiusY: 100 + direction: model.index === 0 ? PathArc.Clockwise : PathArc.Counterclockwise + } + } + } + } + } + } + + Item { + width: 200 + height: 100 + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "green" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: VisualPath.DashLine + strokeWidth: 4 + + Path { + startX: 50; startY: 100 + PathArc { + x: 100; y: 150 + radiusX: 50; radiusY: 50 + useLargeArc: model.index === 1 + } + } + } + } + } + } + + Item { + width: 200 + height: 100 + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "gray" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: VisualPath.DashLine + strokeWidth: 4 + + Path { + startX: 50; startY: 150 + PathArc { + x: 150; y: 150 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + } + } + } + } + } + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + fillColor: "lightGray" + strokeColor: model.index === 0 ? "red" : "blue" + + Path { + startX: 50; startY: 150 + PathArc { + x: 150; y: 150 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + direction: PathArc.Counterclockwise + } + } + } + } + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_cubic.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_cubic.qml new file mode 100644 index 0000000000..f2e2247bb9 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_cubic.qml @@ -0,0 +1,36 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + Column { + Repeater { + model: 4 + Item { + width: 200 + height: 100 + + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + strokeWidth: (model.index + 2) * 2 + strokeColor: "black" + fillColor: "lightBlue" + + Path { + startX: 50; startY: 100 + PathCubic { + x: 150; y: 100 + control1X: model.index * 10; control1Y: model.index * 5 + control2X: model.index * -10; control2Y: model.index * 10 + } + } + } + } + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_linear_gradient.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_linear_gradient.qml new file mode 100644 index 0000000000..a8a27a6bf7 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_linear_gradient.qml @@ -0,0 +1,34 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + PathItem { + enableVendorExtensions: false + + anchors.fill: parent + + VisualPath { + strokeWidth: 4 + strokeColor: "red" + fillGradient: PathLinearGradient { + x1: 20; y1: 20 + x2: 180; y2: 130 + PathGradientStop { position: 0; color: "blue" } + PathGradientStop { position: 0.2; color: "green" } + PathGradientStop { position: 0.4; color: "red" } + PathGradientStop { position: 0.6; color: "yellow" } + PathGradientStop { position: 1; color: "cyan" } + } + strokeStyle: VisualPath.DashLine + dashPattern: [ 1, 4 ] + Path { + startX: 20; startY: 20 + PathLine { x: 180; y: 130 } + PathLine { x: 20; y: 130 } + PathLine { x: 20; y: 20 } + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_lines.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_lines.qml new file mode 100644 index 0000000000..e6480b37c5 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_lines.qml @@ -0,0 +1,109 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + PathItem { + enableVendorExtensions: false + + anchors.fill: parent + + VisualPath { + strokeWidth: 1 + strokeColor: "red" + fillColor: "transparent" + Path { + PathLine { x: 50; y: 50 } + } + } + VisualPath { + strokeWidth: 2 + strokeColor: "blue" + fillColor: "transparent" + Path { + startX: 20 + PathLine { x: 70; y: 50 } + } + } + VisualPath { + strokeWidth: 3 + strokeColor: "green" + fillColor: "transparent" + Path { + startX: 40 + PathLine { x: 90; y: 50 } + } + } + VisualPath { + strokeWidth: 4 + strokeColor: "yellow" + fillColor: "transparent" + Path { + startX: 60 + PathLine { x: 110; y: 50 } + } + } + VisualPath { + strokeWidth: 5 + strokeColor: "black" + fillColor: "transparent" + strokeStyle: VisualPath.DashLine + Path { + startX: 80 + PathLine { x: 130; y: 50 } + } + } + + VisualPath { + strokeWidth: 20 + strokeColor: "gray" + fillColor: "transparent" + capStyle: VisualPath.RoundCap + Path { + startX: 120; startY: 20 + PathLine { x: 200; y: 100 } + } + } + + VisualPath { + strokeColor: "black" + strokeWidth: 16 + fillColor: "transparent" + capStyle: VisualPath.RoundCap + joinStyle: VisualPath.BevelJoin + Path { + startX: 20 + startY: 100 + PathLine { x: 120; y: 200 } + PathLine { x: 50; y: 200 } + } + } + VisualPath { + strokeColor: "black" + strokeWidth: 16 + fillColor: "transparent" + capStyle: VisualPath.RoundCap + joinStyle: VisualPath.MiterJoin + Path { + startX: 150 + startY: 100 + PathLine { x: 250; y: 200 } + PathLine { x: 180; y: 200 } + } + } + VisualPath { + strokeColor: "black" + strokeWidth: 16 + fillColor: "transparent" + capStyle: VisualPath.RoundCap + joinStyle: VisualPath.RoundJoin + Path { + startX: 270 + startY: 100 + PathLine { x: 310; y: 200 } + PathLine { x: 280; y: 200 } + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_quad.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_quad.qml new file mode 100644 index 0000000000..8953505786 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_quad.qml @@ -0,0 +1,35 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + Column { + Repeater { + model: 4 + Item { + width: 200 + height: 100 + + PathItem { + anchors.fill: parent + enableVendorExtensions: false + + VisualPath { + strokeWidth: (model.index + 2) * 2 + strokeColor: "black" + fillColor: "lightBlue" + + Path { + startX: 50; startY: 100 + PathQuad { + x: 150; y: 100 + controlX: model.index * 10; controlY: model.index * 5 + } + } + } + } + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_spread.qml b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_spread.qml new file mode 100644 index 0000000000..912c3d62f0 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/pathitem/pathitem_spread.qml @@ -0,0 +1,36 @@ +import QtQuick 2.9 + +Item { + width: 320 + height: 480 + + Column { + Repeater { + model: 3 + PathItem { + enableVendorExtensions: false + width: 200 + height: 150 + VisualPath { + strokeColor: "transparent" + + fillGradient: PathLinearGradient { + id: grad + y1: 50; y2: 80 + spread: model.index === 0 ? PathGradient.PadSpread : (model.index === 1 ? PathGradient.RepeatSpread : PathGradient.ReflectSpread) + PathGradientStop { position: 0; color: "black" } + PathGradientStop { position: 1; color: "red" } + } + + Path { + startX: 10; startY: 10 + PathLine { relativeX: 180; relativeY: 0 } + PathLine { relativeX: 0; relativeY: 100 } + PathLine { relativeX: -180; relativeY: 0 } + PathLine { relativeX: 0; relativeY: -100 } + } + } + } + } + } +} -- cgit v1.2.3