From c055b5e9331d94b74026029176ef84283153ca7b Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Tue, 28 Dec 2021 17:47:59 +0100 Subject: rbutil: Add data tags to data driven unit tests. Make tests implemented as data driven tests show a sensible test data tag value, so test can get identified more easily. Change-Id: Ifeb42ed11ce9a8efc6491b2c3b9fe31802a67d33 --- utils/rbutilqt/test/test-playerbuildinfo.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'utils/rbutilqt/test/test-playerbuildinfo.cpp') diff --git a/utils/rbutilqt/test/test-playerbuildinfo.cpp b/utils/rbutilqt/test/test-playerbuildinfo.cpp index a250e37979..4dd5773576 100644 --- a/utils/rbutilqt/test/test-playerbuildinfo.cpp +++ b/utils/rbutilqt/test/test-playerbuildinfo.cpp @@ -82,10 +82,10 @@ Q_DECLARE_METATYPE(PlayerBuildInfo::BuildType); Q_DECLARE_METATYPE(PlayerBuildInfo::DeviceInfo); struct { - QString target; + const char* target; PlayerBuildInfo::BuildInfo item; PlayerBuildInfo::BuildType type; - QString expected; + const char* expected; } testdataBuild[] = { // release builds @@ -132,9 +132,9 @@ struct { }; struct { - QString target; + const char* target; PlayerBuildInfo::DeviceInfo item; - QString expected; + const char* expected; } testdataPlayer[] = { { "archosfmrecorder", PlayerBuildInfo::BuildStatus, "3" }, @@ -166,8 +166,13 @@ void TestPlayerBuildInfo::testBuildInfo_data() QTest::addColumn("type"); QTest::addColumn("expected"); for (size_t i = 0; i < sizeof(testdataBuild) / sizeof(testdataBuild[0]); i++) - QTest::newRow("") << testdataBuild[i].target << testdataBuild[i].item - << testdataBuild[i].type << testdataBuild[i].expected; + { + char tag[30]; + snprintf(tag, sizeof(tag), "%s-%i-%i", + testdataBuild[i].target, testdataBuild[i].item, testdataBuild[i].type); + QTest::newRow(tag) << testdataBuild[i].target << testdataBuild[i].item + << testdataBuild[i].type << testdataBuild[i].expected; + } } @@ -204,8 +209,13 @@ void TestPlayerBuildInfo::testPlayerInfo_data() QTest::addColumn("item"); QTest::addColumn("expected"); for (size_t i = 0; i < sizeof(testdataPlayer) / sizeof(testdataPlayer[0]); i++) - QTest::newRow("") << testdataPlayer[i].target << testdataPlayer[i].item - << testdataPlayer[i].expected; + { + char tag[30]; + snprintf(tag, sizeof(tag), "%s-%i", + testdataPlayer[i].target, testdataPlayer[i].item); + QTest::newRow(tag) << testdataPlayer[i].target << testdataPlayer[i].item + << testdataPlayer[i].expected; + } } void TestPlayerBuildInfo::testPlayerInfo() -- cgit v1.2.3