summaryrefslogtreecommitdiff
path: root/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-07 03:01:06 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-07 03:01:06 +0100
commitb714eeba4163c03532ac9cd017095dba8932a81c (patch)
treea0f3a238b4097ef0907bfe9ea44c7f954551c1e8 /tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp
parent4c155d94a294ace4a402f135272f04bcd73f4732 (diff)
parent089bdc0fcc1d87c6f5fe0835a4f723a6677e9a01 (diff)
downloadqtxmlpatterns-b714eeba4163c03532ac9cd017095dba8932a81c.tar.gz
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I967a3678e5791457e25618e46611f6327e182c70
Diffstat (limited to 'tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp')
-rw-r--r--tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp
index b128bef..51ef07d 100644
--- a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp
+++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp
@@ -74,6 +74,8 @@ private Q_SLOTS:
void uriResolverSignature() const;
void uriResolverDefaultValue() const;
void uriResolver() const;
+
+ void unionCrash() const;
};
static QXmlSchema createValidSchema()
@@ -456,6 +458,27 @@ void tst_QXmlSchemaValidator::uriResolver() const
}
}
+void tst_QXmlSchemaValidator::unionCrash() const
+{
+ // Regression test for QTBUG-77620 (segfault on nullptr dereference).
+ const QString path = QFINDTESTDATA("testdata/");
+ QXmlSchema schema;
+
+ const QString filePath = path + QLatin1String("QTBUG-77620.xsd");
+
+ QFile file(filePath);
+ QVERIFY(file.open(QIODevice::ReadOnly));
+
+ schema.load(file.readAll(), QUrl(filePath));
+ QVERIFY2(schema.isValid(), "Schema should be found valid.");
+ // Validate instance
+ QXmlSchemaValidator validator(schema);
+ QEXPECT_FAIL("", "QTBUG-77620: " // Fixed crash, but not underlying problem:
+ "the code fails to record the CUSTOM_KEY's primitive type as pattern_type", Continue);
+ QVERIFY2(validator.validate(QUrl(path + QLatin1String("QTBUG-77620.xml"))),
+ "Document should be found valid");
+}
+
QTEST_MAIN(tst_QXmlSchemaValidator)
#include "tst_qxmlschemavalidator.moc"