summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-09 08:05:15 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-09 08:05:15 (GMT)
commitb4d3a334634e84c04974de6929b21107a19a3502 (patch)
tree6530a6822b89e72b6c01c231ed944d31f3133820 /tests/auto
parent9a32c5940f259f101f13b91dcb95d9861fb9043d (diff)
parent6594b23e79079f4d789a917209e35e894e4f8b76 (diff)
downloadQt-b4d3a334634e84c04974de6929b21107a19a3502.zip
Qt-b4d3a334634e84c04974de6929b21107a19a3502.tar.gz
Qt-b4d3a334634e84c04974de6929b21107a19a3502.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed bounds calculation in QtSvg. Fixed vector-effect property output from QSvgGenerator. Added text benchmarks from qtbench to tests/benchmarks
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qsvggenerator/referenceSvgs/fileName_output.svg6
-rw-r--r--tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg10
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp31
3 files changed, 39 insertions, 8 deletions
diff --git a/tests/auto/qsvggenerator/referenceSvgs/fileName_output.svg b/tests/auto/qsvggenerator/referenceSvgs/fileName_output.svg
index 99926b3..f1f9e35 100644
--- a/tests/auto/qsvggenerator/referenceSvgs/fileName_output.svg
+++ b/tests/auto/qsvggenerator/referenceSvgs/fileName_output.svg
@@ -4,12 +4,12 @@
<desc>Generated with Qt</desc>
<defs>
</defs>
-<g fill="none" stroke="black" vector-effect="non-scaling-stroke" stroke-width="1" fill-rule="evenodd" stroke-linecap="square" stroke-linejoin="bevel" >
+<g fill="none" stroke="black" stroke-width="1" fill-rule="evenodd" stroke-linecap="square" stroke-linejoin="bevel" >
<g fill="#ff0000" fill-opacity="1" stroke="none" transform="matrix(1,0,0,1,0,0)"
-font-family="Arial" font-size="11pt" font-weight="400" font-style="normal"
+font-family="Sans Serif" font-size="8.25" font-weight="400" font-style="normal"
>
-<path fill-rule="evenodd" d="M0,0 L100,0 L100,100 L0,100 L0,0"/>
+<path vector-effect="non-scaling-stroke" fill-rule="evenodd" d="M0,0 L100,0 L100,100 L0,100 L0,0"/>
</g>
</g>
</svg>
diff --git a/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg b/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg
index f61dd40..84afbf3 100644
--- a/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg
+++ b/tests/auto/qsvggenerator/referenceSvgs/radial_gradient.svg
@@ -13,18 +13,18 @@
<stop offset="1" stop-color="#0000ff" stop-opacity="1" />
</radialGradient>
</defs>
-<g fill="none" stroke="black" vector-effect="non-scaling-stroke" stroke-width="1" fill-rule="evenodd" stroke-linecap="square" stroke-linejoin="bevel" >
+<g fill="none" stroke="black" stroke-width="1" fill-rule="evenodd" stroke-linecap="square" stroke-linejoin="bevel" >
<g fill="url(#gradient1)" stroke="none" transform="matrix(1,0,0,1,0,0)"
-font-family="Sans Serif" font-size="9pt" font-weight="400" font-style="normal"
+font-family="Sans Serif" font-size="8.25" font-weight="400" font-style="normal"
>
-<path fill-rule="evenodd" d="M0,0 L100,0 L100,100 L0,100 L0,0"/>
+<path vector-effect="non-scaling-stroke" fill-rule="evenodd" d="M0,0 L100,0 L100,100 L0,100 L0,0"/>
</g>
<g fill="url(#gradient2)" stroke="none" transform="matrix(1,0,0,1,0,0)"
-font-family="Sans Serif" font-size="9pt" font-weight="400" font-style="normal"
+font-family="Sans Serif" font-size="8.25" font-weight="400" font-style="normal"
>
-<path fill-rule="evenodd" d="M100,0 L200,0 L200,100 L100,100 L100,0"/>
+<path vector-effect="non-scaling-stroke" fill-rule="evenodd" d="M100,0 L200,0 L200,100 L100,100 L100,0"/>
</g>
</g>
</svg>
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 16dd2b4..106fd8c 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -74,6 +74,7 @@ private slots:
void nestedQXmlStreamReader() const;
void stylePropagation() const;
void matrixForElement() const;
+ void boundsOnElement() const;
void gradientStops() const;
void gradientRefs();
void fillRule();
@@ -470,6 +471,36 @@ void tst_QSvgRenderer::matrixForElement() const
compareTransforms(QTransform(painter.worldMatrix()), QTransform(renderer.matrixForElement(QLatin1String("firkant"))));
}
+void tst_QSvgRenderer::boundsOnElement() const
+{
+ QByteArray data("<svg>"
+ "<g id=\"prim\" transform=\"translate(-3,1)\">"
+ "<g id=\"sjokade\" stroke=\"none\" stroke-width=\"10\">"
+ "<rect id=\"kaviar\" transform=\"rotate(45)\" x=\"-10\" y=\"-10\" width=\"20\" height=\"20\"/>"
+ "</g>"
+ "<g id=\"nugatti\" stroke=\"black\" stroke-width=\"2\">"
+ "<use x=\"0\" y=\"0\" transform=\"rotate(45)\" xlink:href=\"#kaviar\"/>"
+ "</g>"
+ "<g id=\"nutella\" stroke=\"none\" stroke-width=\"10\">"
+ "<path id=\"baconost\" transform=\"rotate(45)\" d=\"M-10 -10 L10 -10 L10 10 L-10 10 Z\"/>"
+ "</g>"
+ "<g id=\"hapaa\" transform=\"translate(-2,2)\" stroke=\"black\" stroke-width=\"2\">"
+ "<use x=\"0\" y=\"0\" transform=\"rotate(45)\" xlink:href=\"#baconost\"/>"
+ "</g>"
+ "</g>"
+ "</svg>");
+
+ qreal sqrt2 = qSqrt(2);
+ QSvgRenderer renderer(data);
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("sjokade")), QRectF(-10 * sqrt2, -10 * sqrt2, 20 * sqrt2, 20 * sqrt2));
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("kaviar")), QRectF(-10 * sqrt2, -10 * sqrt2, 20 * sqrt2, 20 * sqrt2));
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("nugatti")), QRectF(-11, -11, 22, 22));
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("nutella")), QRectF(-10 * sqrt2, -10 * sqrt2, 20 * sqrt2, 20 * sqrt2));
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("baconost")), QRectF(-10 * sqrt2, -10 * sqrt2, 20 * sqrt2, 20 * sqrt2));
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("hapaa")), QRectF(-13, -9, 22, 22));
+ QCOMPARE(renderer.boundsOnElement(QLatin1String("prim")), QRectF(-10 * sqrt2 - 3, -10 * sqrt2 + 1, 20 * sqrt2, 20 * sqrt2));
+}
+
void tst_QSvgRenderer::gradientStops() const
{
{