Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
There's currently no good way to supply test data to LocalStorage for Unit Tests:
As LocalStorage can't open certain database files but only databases with a given name lying around at the QtQmlEngines offlineStoragePath, it is currently not possible to open a given database including test data (my usecase: testing a database migration).
Currently the only options to open a certain database are:
- MD5-hashing the wanted database name, name the database & ini files that way (AFAIK this isn't stable API, though)
- determine the offlineStoragePath of the application & put the files there or change the path with QQmlEngine::setOfflineStoragePath{{}}
This is neither convenient nor easy to do, furthermore changing QQmlEngine attributes is hard when using the QUICK_TEST_MAIN testrunner harnisch macro.
If there shall be no support in LocalStorage itself for opening certain files, support for supplying test databases should be at least available as a part of QtQuickTest.