diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-03-09 14:00:08 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-04-13 07:14:18 +0000 |
commit | b542d479071c0ffe3edde326a40b9d885e19ff6a (patch) | |
tree | cb70d0a5f0d1d63144834b3e115fe0178740a59a /tests | |
parent | 9144ab75f41d54b907e323586dbc303400dc0327 (diff) |
Examples: Read meta data, which includes categories
Task-number: QTCREATORBUG-28546
Change-Id: I11505d4f8b8eaef3f525185cd45757b6f41012ec
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
(cherry picked from commit e060f82fa56131436a0c578c5857501b53ef7978)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/examples/tst_examples.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/examples/tst_examples.cpp b/tests/auto/examples/tst_examples.cpp index 22236ed4c5d..5a18f1e4498 100644 --- a/tests/auto/examples/tst_examples.cpp +++ b/tests/auto/examples/tst_examples.cpp @@ -25,6 +25,8 @@ private slots: tst_Examples::tst_Examples() = default; tst_Examples::~tst_Examples() = default; +using MetaData = QHash<QString, QStringList>; + static ExampleItem fetchItem() { QFETCH(QString, name); @@ -43,6 +45,7 @@ static ExampleItem fetchItem() QFETCH(QString, videoUrl); QFETCH(QString, videoLength); QFETCH(QStringList, platforms); + QFETCH(MetaData, metaData); ExampleItem item; item.name = name; item.description = description; @@ -60,6 +63,7 @@ static ExampleItem fetchItem() item.videoUrl = videoUrl; item.videoLength = videoLength; item.platforms = platforms; + item.metaData = metaData; return item; } @@ -83,6 +87,7 @@ void tst_Examples::parsing_data() QTest::addColumn<QString>("videoUrl"); QTest::addColumn<QString>("videoLength"); QTest::addColumn<QStringList>("platforms"); + QTest::addColumn<MetaData>("metaData"); QTest::addRow("example") << QByteArray(R"raw( @@ -115,7 +120,7 @@ void tst_Examples::parsing_data() "manifest/widgets/widgets/analogclock/analogclock.cpp")} << FilePath::fromUserInput("manifest/widgets/widgets/analogclock/analogclock.cpp") << FilePaths() << Example << true << false << false << "" - << "" << QStringList(); + << "" << QStringList() << MetaData({{"category", {"Graphics"}}, {"tags", {"widgets"}}}); } void tst_Examples::parsing() @@ -148,6 +153,7 @@ void tst_Examples::parsing() QCOMPARE(item.videoUrl, expected.videoUrl); QCOMPARE(item.videoLength, expected.videoLength); QCOMPARE(item.platforms, expected.platforms); + QCOMPARE(item.metaData, expected.metaData); qDeleteAll(*result); } |