summaryrefslogtreecommitdiff
path: root/tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-08-20 11:15:22 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-12-04 11:17:46 +0100
commit089bdc0fcc1d87c6f5fe0835a4f723a6677e9a01 (patch)
treed4e3c15a9f44e4b7dcbd8efa1a1cc3f3aa3aae09 /tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd
parent9e7745d7e283570ca8504909d20c39d3aca18cf7 (diff)
downloadqtxmlpatterns-089bdc0fcc1d87c6f5fe0835a4f723a6677e9a01.tar.gz
Catch invalid simple type that was causing a crash
Although the type passes a check that's supposed to find all types with a simple type, and appears to be of a simple type, its primitive type is apparently null. This was causing a segmentation fault. Apparently the code fails to correctly set the primitive type of a pattern-type instance of a union type. Document the known limitation by a QEXPECT_FAIL() in the test; I was unable to find where the primitive type should be set. Task-number: QTBUG-77620 Change-Id: I56b95ed815366c508f71b8af03b6f2a653d338c5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd')
-rw-r--r--tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd b/tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd
new file mode 100644
index 0000000..33657c7
--- /dev/null
+++ b/tests/auto/qxmlschemavalidator/testdata/QTBUG-77620.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:simpleType name="pattern_type">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="CUSTOM_[0-9a-zA-Z]+" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="enum_type">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="KEY1" />
+ <xs:enumeration value="KEY2" />
+ <!-- Note: *no* matching entry for key "CUSTOM_KEY1" -->
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="union_type">
+ <xs:union memberTypes="enum_type pattern_type" />
+ </xs:simpleType>
+
+ <xs:element name="root">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="key" type="union_type" use="required" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:key name="primary_key">
+ <xs:selector xpath="./item" />
+ <xs:field xpath="@key" />
+ </xs:key>
+ </xs:element>
+</xs:schema>