diff options
author | David Faure <david.faure@kdab.com> | 2015-08-25 14:30:07 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2015-09-04 20:00:22 +0000 |
commit | 5e41f4137dd42a9a639be8743ae95c8e159bd4e0 (patch) | |
tree | 458a432ed04ddd9556a97358c2bbf9212fecbf57 /tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml | |
parent | 880a8aa7e99bb91e7a815cadde72bb5230c815ea (diff) |
QMimeDatabase: warn instead of asserting on bad magic.
An invalid mime magic definition could lead to an assert. Replaced with
a qWarning. Move all checking to the QMimeMagicRule constructor, and do
keep invalid rules since they are need to parse child rules.
Unit test added, with QTest::ignoreMessage when using the XML backend
(there's no warning from update-mime-database when using the cache).
Also make it easier to add more shared mime info files for tests.
Task-number: QTBUG-44319
Done-with: Eike Ziller <eike.ziller@theqtcompany.com>
Change-Id: Ie39a160a106b650cdcee88778fa7eff9e932a988
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml')
-rw-r--r-- | tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml new file mode 100644 index 0000000000..04204d8763 --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> + <mime-type type="text/invalid-magic1"> + <comment>wrong value for byte type</comment> + <magic> + <match value="foo" type="byte" offset="0"/> + </magic> + </mime-type> +</mime-info> |