diff options
author | Karim Pinter <karim.pinter@qt.io> | 2017-02-02 14:16:16 +0200 |
---|---|---|
committer | Karim Pinter <karim.pinter@qt.io> | 2017-02-08 07:04:25 +0000 |
commit | f6e5f6eaf2eb958aa043440c8941b25339644360 (patch) | |
tree | 1c7faee89ee0926a0146319c728b1144e5aaf1dd /tests/auto | |
parent | 57a1b273a42746755bbcd93a74245d17afd81625 (diff) | |
download | qtxmlpatterns-f6e5f6eaf2eb958aa043440c8941b25339644360.tar.gz |
Fix previous fix for trailing 0 handling
The previous fix, 82c5cc6532ac5d0323ecda94b6767e1fdaef2639, wasn't
handling properly double conversion to string, this change is rather
going through the characters instead. It also adds new test cases.
Task-number: QTBUG-58245
Change-Id: I1563d541b0c9fef1254b5fb728308fb2517ed3aa
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto')
4 files changed, 31 insertions, 1 deletions
diff --git a/tests/auto/xmlpatternsvalidator/files/fractiondigits-invalid.xml b/tests/auto/xmlpatternsvalidator/files/fractiondigits-invalid.xml new file mode 100644 index 0000000..893c837 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/fractiondigits-invalid.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:number xmlns:tns="http://www.example.org/FractionDigitsTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/FractionDigitsTest FractionDigitsTest.xsd"> + <tns:value>1234.560000000000000001</tns:value> +</tns:number> + diff --git a/tests/auto/xmlpatternsvalidator/files/fractiondigits-nodot.xml b/tests/auto/xmlpatternsvalidator/files/fractiondigits-nodot.xml new file mode 100644 index 0000000..6024b9e --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/fractiondigits-nodot.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:number xmlns:tns="http://www.example.org/FractionDigitsTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/FractionDigitsTest FractionDigitsTest.xsd"> + <tns:value>123456</tns:value> +</tns:number> + diff --git a/tests/auto/xmlpatternsvalidator/files/fractiondigits-nonumber.xml b/tests/auto/xmlpatternsvalidator/files/fractiondigits-nonumber.xml new file mode 100644 index 0000000..ef17df3 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/fractiondigits-nonumber.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tns:number xmlns:tns="http://www.example.org/FractionDigitsTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/FractionDigitsTest FractionDigitsTest.xsd"> + <tns:value>.56</tns:value> +</tns:number> + diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 8a11418..79f86d9 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -227,11 +227,26 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << (QStringList() << path + QLatin1String("substitution-group-invalid.xml") << path + QLatin1String("substitution-group.xsd")) << QString(); - QTest::newRow("QTBUG-58245 fraction digits shouldn't take trailing 0 into account") + QTest::newRow("QTBUG-58245 fraction digits should ignore trailing 0") << 0 << (QStringList() << path + QLatin1String("fractiondigits.xml") << path + QLatin1String("fractiondigits.xsd")) << QString(); + QTest::newRow("QTBUG-58245 fraction digits should ignore trailing 0 with no dots") + << 0 + << (QStringList() << path + QLatin1String("fractiondigits-nodot.xml") + << path + QLatin1String("fractiondigits.xsd")) + << QString(); + QTest::newRow("QTBUG-58245 fraction digits should ignore trailing 0 with no number before dot") + << 0 + << (QStringList() << path + QLatin1String("fractiondigits-nonumber.xml") + << path + QLatin1String("fractiondigits.xsd")) + << QString(); + QTest::newRow("QTBUG-58245 fraction digits should ignore trailing 0 invalid") + << 1 + << (QStringList() << path + QLatin1String("fractiondigits-invalid.xml") + << path + QLatin1String("fractiondigits.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) |