diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-09 03:02:27 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-09 03:02:27 +0100 |
commit | 8ca3b32561b68bed3b5897e87aa912c93e9739c4 (patch) | |
tree | 488a83eae15183e59311b74cc642fb3d094afe27 /tests/auto | |
parent | 65011e9f1b23ab62fff8d9327eeafedd29c91332 (diff) | |
parent | 6f152f87dbbd47acc58458d636ce5d1cc181b8fd (diff) | |
download | qtsvg-8ca3b32561b68bed3b5897e87aa912c93e9739c4.tar.gz |
Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta1
Change-Id: I53ec3fb5c2aa7aa953628d2ef56fead24ce0160f
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 30d6712..7922a29 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -77,6 +77,7 @@ private slots: void testUseElement(); void smallFont(); void styleSheet(); + void duplicateStyleId(); #ifndef QT_NO_COMPRESS void testGzLoading(); @@ -139,22 +140,28 @@ void tst_QSvgRenderer::invalidUrl_data() { QTest::addColumn<QByteArray>("svg"); - QTest::newRow("00") << QByteArray("<svg><circle fill=\"url\" /></svg>"); - QTest::newRow("01") << QByteArray("<svg><circle fill=\"url0\" /></svg>"); - QTest::newRow("02") << QByteArray("<svg><circle fill=\"url(0\" /></svg>"); - QTest::newRow("03") << QByteArray("<svg><circle fill=\"url (0\" /></svg>"); - QTest::newRow("04") << QByteArray("<svg><circle fill=\"url ( 0\" /></svg>"); - QTest::newRow("05") << QByteArray("<svg><circle fill=\"url#\" /></svg>"); - QTest::newRow("06") << QByteArray("<svg><circle fill=\"url#(\" /></svg>"); - QTest::newRow("07") << QByteArray("<svg><circle fill=\"url(#\" /></svg>"); - QTest::newRow("08") << QByteArray("<svg><circle fill=\"url(# \" /></svg>"); - QTest::newRow("09") << QByteArray("<svg><circle fill=\"url(# 0\" /></svg>"); + QTest::newRow("01") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url0\" /></svg>"); + QTest::newRow("02") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url(0\" /></svg>"); + QTest::newRow("03") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url (0\" /></svg>"); + QTest::newRow("04") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url ( 0\" /></svg>"); + QTest::newRow("05") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url#\" /></svg>"); + QTest::newRow("06") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url#(\" /></svg>"); + QTest::newRow("07") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url(#\" /></svg>"); + QTest::newRow("08") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url(# \" /></svg>"); + QTest::newRow("09") << QByteArray("<svg><linearGradient id=\"0\"/><circle fill=\"url(# 0\" /></svg>"); + QTest::newRow("10") << QByteArray("<svg><linearGradient id=\"blabla\"/><circle fill=\"urlblabla\" /></svg>"); + QTest::newRow("11") << QByteArray("<svg><linearGradient id=\"blabla\"/><circle fill=\"url(blabla\" /></svg>"); + QTest::newRow("12") << QByteArray("<svg><linearGradient id=\"blabla\"/><circle fill=\"url(blabla)\" /></svg>"); + QTest::newRow("13") << QByteArray("<svg><linearGradient id=\"blabla\"/><circle fill=\"url(#blabla\" /></svg>"); } void tst_QSvgRenderer::invalidUrl() { QFETCH(QByteArray, svg); +#if QT_CONFIG(regularexpression) + QTest::ignoreMessage(QtWarningMsg, QRegularExpression("Could not resolve property")); +#endif QSvgRenderer renderer(svg); QVERIFY(renderer.isValid()); } @@ -1459,5 +1466,17 @@ void tst_QSvgRenderer::styleSheet() QCOMPARE(images[0], images[1]); } +void tst_QSvgRenderer::duplicateStyleId() +{ + QByteArray svg = QByteArrayLiteral("<svg><linearGradient id=\"a\"/>" + "<rect style=\"fill:url(#a)\"/>" + "<linearGradient id=\"a\"/></svg>"); + QTest::ignoreMessage(QtWarningMsg, "Duplicate unique style id: \"a\""); + QImage image(200, 200, QImage::Format_RGB32); + QPainter painter(&image); + QSvgRenderer renderer(svg); + renderer.render(&painter); +} + QTEST_MAIN(tst_QSvgRenderer) #include "tst_qsvgrenderer.moc" |