diff --git a/tests/run_test.sh b/tests/run_test.sh
new file mode 100755
index 0000000..0d251d2
--- /dev/null
+++ b/tests/run_test.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+export BASENAME=$1
+export TESTCASE=$2
+export DEVICEUSER=$(getent passwd $(grep '^UID_MIN' /etc/login.defs | tr -s ' ' | cut -d ' ' -f2) | sed 's/:.*//')
+export LIBCONTACTS_TEST_MODE=1
+/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/$BASENAME/contacts/$TESTCASE" "$DEVICEUSER"
diff --git a/tests/tests.pro b/tests/tests.pro
index f064bdf..4f63a2e 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -9,6 +9,8 @@ SUBDIRS = \
tst_seasidefilteredmodel \
tst_seasidestringlistcompressor
+OTHER_FILES += $$PWD/tests.xml.in $$PWD/run_test.sh
+
tests_xml.target = tests.xml
tests_xml.depends = $$PWD/tests.xml.in
tests_xml.commands = sed -e "s:@BASENAME@:$${BASENAME}:g" $< > $@
@@ -19,7 +21,7 @@ QMAKE_CLEAN += $$tests_xml.target
PRE_TARGETDEPS += $$tests_xml.target
tests_install.path = /opt/tests/$${BASENAME}/contacts/
-tests_install.files = $$tests_xml.target
+tests_install.files = $$tests_xml.target $$PWD/run_test.sh
tests_install.depends = tests_xml
tests_install.CONFIG += no_check_exist
diff --git a/tests/tests.xml.in b/tests/tests.xml.in
index 1f84194..7b6a1cb 100644
--- a/tests/tests.xml.in
+++ b/tests/tests.xml.in
@@ -5,13 +5,16 @@
Contact cache automatic tests
- LIBCONTACTS_TEST_MODE=1 /usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/@PACKAGENAME@/tst_synchronizelists' nemo
+ /opt/tests/@BASENAME@/contacts/run_test.sh @BASENAME@ tst_synchronizelists
- LIBCONTACTS_TEST_MODE=1 /usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/@PACKAGENAME@/tst_seasideimport' nemo
+ /opt/tests/@BASENAME@/contacts/run_test.sh @BASENAME@ tst_seasideimport
- LIBCONTACTS_TEST_MODE=1 /usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/@PACKAGENAME@/tst_resolve' nemo
+ /opt/tests/@BASENAME@/contacts/run_test.sh @BASENAME@ tst_resolve
+
+
+ /opt/tests/@BASENAME@/contacts/run_test.sh @BASENAME@ tst_seasidestringlistcompressor
@@ -20,10 +23,10 @@
Contacts QML plugin automatic tests
- /opt/tests/@BASENAME@/contacts/tst_seasideperson
+ /opt/tests/@BASENAME@/contacts/run_test.sh @BASENAME@ tst_seasideperson
- /opt/tests/@BASENAME@/contacts/tst_seasidefilteredmodel
+ /opt/tests/@BASENAME@/contacts/run_test.sh @BASENAME@ tst_seasidefilteredmodel
diff --git a/tests/tst_seasidefilteredmodel/tst_seasidefilteredmodel.cpp b/tests/tst_seasidefilteredmodel/tst_seasidefilteredmodel.cpp
index 3e9253d..040360f 100644
--- a/tests/tst_seasidefilteredmodel/tst_seasidefilteredmodel.cpp
+++ b/tests/tst_seasidefilteredmodel/tst_seasidefilteredmodel.cpp
@@ -547,21 +547,23 @@ void tst_SeasideFilteredModel::filterCharacters()
QSKIP("Character matching is not testable with unknown locale");
}
- // 1 2 3 4
+ // 1 2 3 4 5 - note that Ælvis will match due to NameDetails.Contains match rule with diacritic decomposition
model.setFilterPattern("Elvis");
- QCOMPARE(model.rowCount(), 4);
+ QCOMPARE(model.rowCount(), 5);
QCOMPARE(model.index(QModelIndex(), 0, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 1);
QCOMPARE(model.index(QModelIndex(), 1, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 2);
QCOMPARE(model.index(QModelIndex(), 2, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 3);
QCOMPARE(model.index(QModelIndex(), 3, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 4);
+ QCOMPARE(model.index(QModelIndex(), 4, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 5);
- // 1 2 3 4
+ // 1 2 3 4 5 - note that Ælvis will match due to NameDetails.Contains match rule with diacritic decomposition
model.setFilterPattern("elvis");
- QCOMPARE(model.rowCount(), 4);
+ QCOMPARE(model.rowCount(), 5);
QCOMPARE(model.index(QModelIndex(), 0, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 1);
QCOMPARE(model.index(QModelIndex(), 1, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 2);
QCOMPARE(model.index(QModelIndex(), 2, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 3);
QCOMPARE(model.index(QModelIndex(), 3, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 4);
+ QCOMPARE(model.index(QModelIndex(), 4, 0).data(SeasideFilteredModel::ContactIdRole).toInt(), 5);
// 3
model.setFilterPattern(QString::fromUtf8(u8"\u00CBlvis")); // 'Ëlvis'
diff --git a/tests/tst_seasideperson/tst_seasideperson.cpp b/tests/tst_seasideperson/tst_seasideperson.cpp
index 9306ebe..f82e89e 100644
--- a/tests/tst_seasideperson/tst_seasideperson.cpp
+++ b/tests/tst_seasideperson/tst_seasideperson.cpp
@@ -160,7 +160,10 @@ void tst_SeasidePerson::sectionBucket()
QSignalSpy spy(person.data(), SIGNAL(displayLabelChanged()));
QCOMPARE(person->displayLabel(), SeasidePerson::placeholderDisplayLabel());
QCOMPARE(spy.count(), 0);
- QCOMPARE(person->sectionBucket(), QString());
+ // ignore the placeholder id if necessary. unit tests don't load translation catalogues.
+ if (person->displayLabel() != QStringLiteral("nemo_contacts-la-placeholder_display_label")) {
+ QCOMPARE(person->sectionBucket(), QString());
+ }
// set first
person->setLastName("Test");