[Digikam-devel] [digikam] [Bug 355831] MySQL Schema Improvements

via KDE Bugzilla bugzilla_noreply at kde.org
Thu Dec 10 05:06:48 GMT 2015


https://bugs.kde.org/show_bug.cgi?id=355831

--- Comment #58 from caulier.gilles at gmail.com ---
Richard

To process C++ test with database, we can use QTest API.

http://doc.qt.io/qt-5/qtest-overview.html

Currently, we have a core/tests/ code to process this kind of check over a
small SQlite database and also MySQL. It located in albummodel and database
sub-dirs.  

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/show/tests/

This code will generate a small CLI application which will process usual tests
with database schema content. The code init a DK core instance, create a
database with few image collection from data sub folder and try to run all
basic operations in database. The QTest API permit to check the results step by
step. And end we can have a resume of tests processed with success or not.

This kind of tests application is started automatically by the KDE Jenkins
server, after a complete core compilation, started after each commit.

https://build.kde.org/job/digikam%20master%20kf5-qt5/

To have all test code compiled in digiKam, use the cmake flag
-DBUILD_TESTING=ON while configuration of digiKam repository. This will enable
tests sub-dir compilation. the tests CLI tools will be compiled in build
directory and can be started as well from a console :

[gilles at localhost database]$ ./databasefieldstest
********* Start testing of DatabaseFieldsTest *********
Config: Using QtTest library 5.5.1, Qt 5.5.1 (x86_64-little_endian-lp64 shared
(dynamic) release build; by GCC 5.2.1 20151020)
PASS   : DatabaseFieldsTest::initTestCase()
PASS   : DatabaseFieldsTest::testMinSizeType()
PASS   : DatabaseFieldsTest::testIterators()
PASS   : DatabaseFieldsTest::testMetaInfo()
PASS   : DatabaseFieldsTest::testIteratorsSetOnly()
PASS   : DatabaseFieldsTest::testSet()
PASS   : DatabaseFieldsTest::testSetHashAddSets()
PASS   : DatabaseFieldsTest::testHashRemoveAll()
PASS   : DatabaseFieldsTest::cleanupTestCase()
Totals: 9 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of DatabaseFieldsTest *********

[gilles at localhost database]$ pwd
/home/gilles/Devel/5.x/build/core/tests/database
[gilles at localhost database]$ 

There are 3 tools  :

-  testdatabase : it reproduce the basis database core init and shutdown. It
used with valgrind to check if core engine has memory leak. You can forget this
one for the moment.

- databasefieldstest : this one is check if the field is DB are processed with
core engine API properly. This one do not play with tags tree.

- albummodeltest : create another small database (SQlite only for the moment)
to check DB album properties in all conditions.

So, if you need a QTest code to check tags tree in DB, i recommend to create a
new small CLI tool based on 2 last one previously described. It's not very well
complicated. init and populate a small DB (Sqlite/Mysql internal) with a small
collection of image including tags in metadata. This will load automatically
the tags tree in DB with DB scan code. After that you can try to change tags
tree as you want in code and use QTest to check if the changes results is right
or not.

Gilles

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Digikam-devel mailing list