diff options
author | Juha Kukkonen <juha.kukkonen@nokia.com> | 2011-10-10 05:36:14 (GMT) |
---|---|---|
committer | Juha Kukkonen <juha.kukkonen@nokia.com> | 2011-10-10 07:15:23 (GMT) |
commit | 22d475e1ef32875c4933b2bb4c2830cb1bdd3266 (patch) | |
tree | 7959bcba424f1108481e26341c4e9e35e12e152d /tests/auto | |
parent | 7e662f3727e7c3dd3c41c29ed49bc41d2b66c744 (diff) | |
download | Qt-22d475e1ef32875c4933b2bb4c2830cb1bdd3266.zip Qt-22d475e1ef32875c4933b2bb4c2830cb1bdd3266.tar.gz Qt-22d475e1ef32875c4933b2bb4c2830cb1bdd3266.tar.bz2 |
Fix XML schema validation failure.
Checking constraining facets for double failed if enumeration
restriction had values INF or NaN.
There were two issues that caused validation to fail:
- wrong conversion function was used when constraining facets for
double are checked, which caused values to be in lower case
- case when both restriction and default value are NaN was not
handled correctly
Task-number: QTBUG-21375
Reviewed-by: Honglei Zhang
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd | 37 | ||||
-rw-r--r-- | tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp | 5 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd b/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd new file mode 100644 index 0000000..532efcb --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <xsd:annotation> + <xsd:documentation xml:lang="en"> + Test for QTBUG-21375: xmlpatternsvalidator does not allow for non-numeric literals in xsd:double attributes + </xsd:documentation> + </xsd:annotation> + + <xsd:element name="test1" type="TestType1" /> + <xsd:element name="test2" type="TestType2" /> + <xsd:element name="test3" type="TestType3" /> + + <xsd:complexType name="TestType1"> + <xsd:attribute name="attribute1" type="DoubleWithRestrictions" default="INF" /> + </xsd:complexType> + + <xsd:complexType name="TestType2"> + <xsd:attribute name="attribute2" type="DoubleWithRestrictions" default="-INF" /> + </xsd:complexType> + + <xsd:complexType name="TestType3"> + <xsd:attribute name="attribute3" type="DoubleWithRestrictions" default="NaN" /> + </xsd:complexType> + + <xsd:simpleType name="DoubleWithRestrictions"> + <xsd:union> + <xsd:simpleType> + <xsd:restriction base="xsd:double"> + <xsd:enumeration value="-INF" /> + <xsd:enumeration value="INF" /> + <xsd:enumeration value="NaN" /> + </xsd:restriction> + </xsd:simpleType> + </xsd:union> + </xsd:simpleType> + +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 817ea1a..60c1fe8 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -222,6 +222,11 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml") << QLatin1String("files/dateTime-with-microseconds.xsd")) << QString(); + + QTest::newRow("QTBUG-21375 A schema with a xs:double based simple type with non-numeric restrictions") + << 0 + << (QStringList() << QLatin1String("files/schema-with-restrictions.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) |