summaryrefslogtreecommitdiffstats
path: root/tests/auto/xmlpatternsvalidator
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2010-06-22 11:53:03 (GMT)
committerPeter Hartmann <peter.hartmann@nokia.com>2010-08-05 11:39:07 (GMT)
commitf3f95d4282ffbfb307e98d20a166ced4cc982061 (patch)
tree2ebf22bcb63c36867bef46777befe1f8f81c6366 /tests/auto/xmlpatternsvalidator
parent7de8a0c487ce6a7f13c2028e93648807ef7d8e8b (diff)
downloadQt-f3f95d4282ffbfb307e98d20a166ced4cc982061.zip
Qt-f3f95d4282ffbfb307e98d20a166ced4cc982061.tar.gz
Qt-f3f95d4282ffbfb307e98d20a166ced4cc982061.tar.bz2
QXmlPatterns QAbstractDateTime: only parse 3 digits of time fraction
the XML Schema dateTime type allows for an unlimited precision of fractial time values; this fails for 4 or more digits when creating a QTime. This patch takes only 3 digits of the time fraction into account, since we cannot store more in a QTime or QDateTime anyway. Reviewed-by: Olivier Goffart Task-number: QTBUG-11559
Diffstat (limited to 'tests/auto/xmlpatternsvalidator')
-rw-r--r--tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml1
-rw-r--r--tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd12
-rw-r--r--tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp6
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml
new file mode 100644
index 0000000..b17739a
--- /dev/null
+++ b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml
@@ -0,0 +1 @@
+<date>2009-12-16T23:14:10.823218Z</date>
diff --git a/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd
new file mode 100644
index 0000000..55557f1
--- /dev/null
+++ b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="date" type="xsd:dateTime"/>
+
+ <xsd:simpleType name="microsecondsType">
+ <xsd:restriction base="xsd:dateTime">
+ <xsd:pattern value="\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d\d\d\dZ"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
index 3517b5a..092e966 100644
--- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
+++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp
@@ -216,6 +216,12 @@ void tst_XmlPatternsValidator::xsdSupport_data() const
<< 0
<< (QStringList() << QLatin1String("files/complex-type-including-anonymous-type.xsd"))
<< QString();
+
+ QTest::newRow("QTBUG-11559 A schema and instance with a dateTime containing microseconds")
+ << 0
+ << (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml")
+ << QLatin1String("files/dateTime-with-microseconds.xsd"))
+ << QString();
}
QTEST_MAIN(tst_XmlPatternsValidator)