summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
Commit message (Collapse)AuthorAgeFilesLines
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QMimeType: simplify implementation of filterStringDavid Faure2023-09-131-0/+2
| | | | | | | As suggested by Ahmad Samir Change-Id: I7f3ef29436a7725b6dceab72bd0f8b01756bf930 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qmimedatabase: move local override to the specific test methodDavid Faure2023-09-131-1/+1
| | | | | | | | | | | | | | | | | | When running tst_qmimedatabase with the full shared-mime-info test suite (which unfortunately requires local setup so this is easy to overlook), we need *.webm to still be associated with video/webm. So to test glob-deleteall, do that in installNewLocalMimeType(), with other similar tests. This however unearthed the following bug: the handling of glob-deleteall is only correct when the local dir has no binary cache. It's broken when using a binary cache. Added a QEXPECT_FAIL for now because this is going to be fixed as part of a major redesign, coming up. I also found out that neither xdgmime nor gio do this correctly... Change-Id: Ib075fcdb792f60a859f23db8c2d7e1c6524f9050 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase: handle glob-deleteall tagsAhmad Samir2023-05-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | According to the Freedesktop spec[1], a mimetype that has glob-deleteall overwrites other glob-pattern definitions for a mimetype if it is in a higher precedence dir, the default order is (from high to low) ~/.local/share/mime, /usr/local/share/mime, /usr/share/mime. Or if the XDG_DATA_DIRS env var is set, then it takes precedence. The QMime*ProviderS in m_providers are constructed/stored in that same order, high to low). For QMimeXMLProvider, we can just clear the glob patterns associated with those mimetypes from the lists/maps. For the QMimeBinaryProvider however, we can't change the binary (mmap'ed) cache file, instead check mimetype names against the exclusion list before modifying a QMimeGlobMatchResult. [1] https://specifications.freedesktop.org/shared-mime-info-spec/latest/ar01s02.html This test uses XDG_DATA_DIRS so only viable when USE_XDG_DATA_DIRS is defined. Fixes: QTBUG-101755 Pick-to: 6.5 Change-Id: Icadbdf1027155296377c5a6ab3be8e41b6668325 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com>
* QMimeDatabase: add a test to ensure we can detect Unix specialsThiago Macieira2023-02-021-0/+4
| | | | | | Pick-to: 6.4 6.5 Change-Id: I570832c9ac8b4e03bde8fffd173f7e743f42f22b Reviewed-by: David Faure <david.faure@kdab.com>
* tst_QMimeDatabase: rename test to indicate what it really isThiago Macieira2023-02-021-2/+2
| | | | | | | | | This test is calling mimeTypeForFileNameAndData(), so it doesn't actually use the files. Change-Id: I570832c9ac8b4e03bde8fffd173f77f138ef3434 Reviewed-by: Igor Kushnir <igorkuo@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-251-0/+1
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/mimetypes/qmimeprovider.cpp src/corelib/mimetypes/qmimetype.cpp Change-Id: Ib483ddb6bfc380e7c8f195feca535703814c3872
| * QMimeType: use default locale rather than system localeDavid Faure2016-08-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible for the application to control which language is used by QMimeType::comment() [ChangeLog][QtCore][QMimeType] QMimeType::comment() now uses the default locale rather than system locale, so that applications can control which language is being used. Task-number: QTBUG-50776 Change-Id: I82623b7c488035a4164fadaf37ebcc79a9fd6173 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Updated license headersJani Heikkinen2016-01-211-17/+12
|/ | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QMimeDatabase: follow symlinks when checking for FIFO etc.David Faure2015-12-291-0/+1
| | | | | | | | | This was documented, but not what the code did. Task-number: QTBUG-48529 Change-Id: I4849778c61dcae13be27c62b24717693c0c07d78 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase: warn instead of asserting on bad magic.David Faure2015-09-041-3/+3
| | | | | | | | | | | | | | | 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>
* QMimeProvider: Do not crash when globPatterns is empty.Milian Wolff2015-08-121-0/+1
| | | | | Change-Id: I351a533a1f03ac2e7bdec876b657a80fac60b2ed Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* QMimeDatabase: Run more tests on non-XDG/shared-mime-info platformsEike Ziller2015-08-111-2/+5
| | | | | | | | | | | | On Windows and OS X, where QStandardPaths does not use XDG_DATA_DIRS/ _HOME and shared-mime-info is not installed, the tests that require additional shared mime info xml files were never run. Mend that by using QStandardPaths' test mode instead of setting XDG_DATA_HOME. Change-Id: I53b75c293c41c4dac63986dcb88972c2b54d5428 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add QMimeType::aliases().David Faure2012-11-221-0/+2
| | | | | | | | | Requested by Allan Sandfeld Jensen for QWebkit, which needs to register upfront all the mimetypes that a given plugin can handle. Change-Id: I64b8d39c7988adfc7db4ed8bfdc73acd16e999da Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase: Fix handling of duplicate mimetype definitions.David Faure2012-11-141-0/+1
| | | | | | | | | | | | | | | When both freedesktop.org.xml and kde.xml define text/x-qml (*.qml), the XML provider would look up *.qml, see two mimetypes, and treat that as a glob conflict, and proceed with contents-based-determination, which for this sample file, would find "C source" due to the C comment. Fixed by ignoring duplicate pattern-mimetype associations. The binary-cache provider doesn't have this problem, update-mime-database already filters out duplicates when generating the on-disk extension tree. Change-Id: Ie335b0b419e7413fa0550779709513f68c2bfc68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* test: Moving tst_QMimeDatabase::inheritsPerformance() testSergio Ahumada2012-10-311-1/+0
| | | | | | | | | | tst_QMimeDatabase::inheritsPerformance() is not an unit test but a performance test, so moving it from 'tests/auto/corelib/mimetypes/qmimedatabase' to 'tests/benchmarks/corelib/mimetypes/qmimedatabase' Change-Id: I59e84f61559023659f101666683870f2ca1d2034 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix tests of QMimeDatabase.Friedemann Kleint2012-02-291-2/+8
| | | | | | | | | | | | | | | - Use temporary directories to avoid instabilities due to remains of previous failed tests and locked directories. - Replace SRCDIR by QFINDTESTDATA(), reference only the freedesktop.org.xml contained in the Qt source tree by $$QT.corelib.sources. - Improve some error messages, test suite instructions for Windows. Change-Id: Idee8e3767ef0a8299df3bdaaac20334164878db0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: David Faure <faure@kde.org>
* Import QMimeType / QMimeDatabase into QtCore.David Faure2012-02-181-0/+99
History of the development before the import: ssh://codereview.qt-project.org/playground/mimetypes.git Mimetype definitions come from shared-mime-info where available (UNIX systems), loaded using a mmap'ed binary cache generated by update-mime-database. As a fallback if no cache is found, we parse the raw XML files otherwise. This makes the MIME type support fast and with very low memory usage on UNIX, and it makes it easy to use on Windows (no dependency on shared-mime-info, Qt even includes a freedesktop.xml file to use if none are found on the system). Change-Id: I27b05008216ff936dc463bd80d3893422bfb940e Reviewed-by: Richard J. Moore <rich@kde.org>