summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/painting
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2020-01-04 15:32:34 +0100
committerLiang Qi <liang.qi@qt.io>2020-01-04 15:32:34 +0100
commita503bf54705d89204007e8f887b668fe5ef519fc (patch)
treeb2d1a452da39450eac78a1aeb1df116a73f64b23 /tests/auto/gui/painting
parente65c43fd0ffa57248e7d750570b7deae171a82f5 (diff)
parent1f87fb359fdff14e42662384a9c8a0bcb3837671 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/corelib/tools/qvector.h Make QVector(DataPointer dd) public to be able to properly merge 5b4b437b30b320e2cd7c9a566999a39772e5d431 from 5.15 into dev. src/widgets/kernel/qapplication.cpp tests/auto/tools/moc/allmocs_baseline_in.json Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r--tests/auto/gui/painting/qbrush/tst_qbrush.cpp6
-rw-r--r--tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp34
-rw-r--r--tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp23
3 files changed, 48 insertions, 15 deletions
diff --git a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp
index f35d4f330b..ac357c92db 100644
--- a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp
+++ b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp
@@ -341,12 +341,6 @@ void tst_QBrush::gradientPresets()
QCOMPARE(lg->stops().at(0), QGradientStop(0, QColor(QLatin1String("#ff9a9e"))));
QCOMPARE(lg->stops().at(1), QGradientStop(0.99, QColor(QLatin1String("#fad0c4"))));
QCOMPARE(lg->stops().at(2), QGradientStop(1, QColor(QLatin1String("#fad0c4"))));
-
-
- QGradient invalidPreset(QGradient::Preset(-1));
- QCOMPARE(invalidPreset.type(), QGradient::NoGradient);
- QBrush brush(invalidPreset);
- QCOMPARE(brush.style(), Qt::NoBrush);
}
void fill(QPaintDevice *pd) {
diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp
index 531e14d25b..945a4772f3 100644
--- a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp
+++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp
@@ -105,37 +105,47 @@ void tst_QColorSpace::movable()
void tst_QColorSpace::namedColorSpaces_data()
{
QTest::addColumn<QColorSpace::NamedColorSpace>("namedColorSpace");
+ QTest::addColumn<bool>("isValid");
QTest::addColumn<QColorSpace::Primaries>("primariesId");
QTest::addColumn<QColorSpace::TransferFunction>("transferFunctionId");
- QTest::newRow("sRGB") << QColorSpace::SRgb
+ QTest::newRow("sRGB") << QColorSpace::SRgb << true
<< QColorSpace::Primaries::SRgb
<< QColorSpace::TransferFunction::SRgb;
- QTest::newRow("sRGB Linear") << QColorSpace::SRgbLinear
+ QTest::newRow("sRGB Linear") << QColorSpace::SRgbLinear << true
<< QColorSpace::Primaries::SRgb
<< QColorSpace::TransferFunction::Linear;
- QTest::newRow("Adobe RGB") << QColorSpace::AdobeRgb
+ QTest::newRow("Adobe RGB") << QColorSpace::AdobeRgb << true
<< QColorSpace::Primaries::AdobeRgb
<< QColorSpace::TransferFunction::Gamma;
- QTest::newRow("Display-P3") << QColorSpace::DisplayP3
+ QTest::newRow("Display-P3") << QColorSpace::DisplayP3 << true
<< QColorSpace::Primaries::DciP3D65
<< QColorSpace::TransferFunction::SRgb;
- QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb
+ QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb << true
<< QColorSpace::Primaries::ProPhotoRgb
<< QColorSpace::TransferFunction::ProPhotoRgb;
+ QTest::newRow("0") << QColorSpace::NamedColorSpace(0)
+ << false
+ << QColorSpace::Primaries::Custom
+ << QColorSpace::TransferFunction::Custom;
+ QTest::newRow("1027") << QColorSpace::NamedColorSpace(1027)
+ << false
+ << QColorSpace::Primaries::Custom
+ << QColorSpace::TransferFunction::Custom;
}
void tst_QColorSpace::namedColorSpaces()
{
QFETCH(QColorSpace::NamedColorSpace, namedColorSpace);
+ QFETCH(bool, isValid);
QFETCH(QColorSpace::Primaries, primariesId);
QFETCH(QColorSpace::TransferFunction, transferFunctionId);
+ if (!isValid)
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace"));
QColorSpace colorSpace = namedColorSpace;
- QVERIFY(colorSpace.isValid());
-
- QCOMPARE(colorSpace, namedColorSpace);
+ QCOMPARE(colorSpace.isValid(), isValid);
QCOMPARE(colorSpace.primaries(), primariesId);
QCOMPARE(colorSpace.transferFunction(), transferFunctionId);
}
@@ -149,15 +159,21 @@ void tst_QColorSpace::toIccProfile_data()
void tst_QColorSpace::toIccProfile()
{
QFETCH(QColorSpace::NamedColorSpace, namedColorSpace);
+ QFETCH(bool, isValid);
QFETCH(QColorSpace::Primaries, primariesId);
QFETCH(QColorSpace::TransferFunction, transferFunctionId);
Q_UNUSED(primariesId);
Q_UNUSED(transferFunctionId);
+ if (!isValid)
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace"));
QColorSpace colorSpace = namedColorSpace;
QByteArray iccProfile = colorSpace.iccProfile();
- QVERIFY(!iccProfile.isEmpty());
+ QCOMPARE(iccProfile.isEmpty(), !isValid);
+
+ if (!isValid)
+ return;
QColorSpace colorSpace2 = QColorSpace::fromIccProfile(iccProfile);
QVERIFY(colorSpace2.isValid());
diff --git a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
index b2b2b685ae..3fbe16575d 100644
--- a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
+++ b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
@@ -112,6 +112,29 @@ void tst_QPdfWriter::basics()
QCOMPARE(writer.pageLayout().fullRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210));
QCOMPARE(writer.pageLayout().paintRect(QPageLayout::Millimeter), QRectF(50, 50, 197, 110));
+
+ QByteArray metadata (
+ "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>\n"
+ "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n"
+ " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\"\n"
+ " <rdf:Description xmlns:dc=\"http://purl.org/dc/elements/1.1/\" rdf:about=\"\">\n"
+ " <dc:title>\n"
+ " <rdf:Alt>\n"
+ " <rdf:li xml:lang=\"x-default\">TITLE</rdf:li>\n"
+ " </rdf:Alt>\n"
+ " </dc:title>\n"
+ " </rdf:Description>\n"
+ " <rdf:Description xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\" rdf:about="" xmp:CreatorTool=\"OUR_OWN_XMP\" xmp:CreateDate=\"2019-12-16T00:00:00+01:00\" xmp:ModifyDate=\"2019-12-16T00:00:00+01:00\"/>\n"
+ " <rdf:Description xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\" rdf:about="" pdf:Producer=\"MetaType Info Producer\"/>\n"
+ " <rdf:Description xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\" rdf:about=\"THI IS ALL ABOUT\" pdfaid:part=\"1\" pdfaid:conformance=\"B\"/>\n"
+ " </rdf:RDF>\n"
+ "</x:xmpmeta>\n"
+ "<?xpacket end='w'?>\n"
+ );
+
+ QCOMPARE(writer.documentXmpMetadata(), QByteArray());
+ writer.setDocumentXmpMetadata(metadata);
+ QCOMPARE(writer.documentXmpMetadata(), metadata);
}
// Test the old page metrics methods, see also QPrinter tests for the same.