┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2018-10-07 17:26:28 +0200
committerElvis Angelaccio <[email protected]>2018-10-07 17:26:28 +0200
commit9204f3272bf7232df86d5da1824f7355c9c0b9c4 (patch)
tree9f74b4336af352573e545670875fd2a66c64b99e
parent92157f6d7d1d6a2226ee3ae7db4bed2e50ee371e (diff)
[PlacesItemModelTest] Fix testGroups() test case
The test was also assuming that the Desktop and Downloads folders are always available, which isn't the case.
-rw-r--r--src/tests/placesitemmodeltest.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp
index 9f5e49d38..8415a58d0 100644
--- a/src/tests/placesitemmodeltest.cpp
+++ b/src/tests/placesitemmodeltest.cpp
@@ -302,26 +302,32 @@ void PlacesItemModelTest::testModelSort()
void PlacesItemModelTest::testGroups()
{
const auto groups = m_model->groups();
-
+ int expectedGroupSize = 3;
+ if (m_hasDesktopFolder) {
+ expectedGroupSize++;
+ }
+ if (m_hasDownloadsFolder) {
+ expectedGroupSize++;
+ }
QCOMPARE(groups.size(), 6);
QCOMPARE(groups.at(0).first, 0);
QCOMPARE(groups.at(0).second.toString(), QStringLiteral("Places"));
- QCOMPARE(groups.at(1).first, 5);
+ QCOMPARE(groups.at(1).first, expectedGroupSize);
QCOMPARE(groups.at(1).second.toString(), QStringLiteral("Remote"));
- QCOMPARE(groups.at(2).first, 7);
+ QCOMPARE(groups.at(2).first, expectedGroupSize + 2);
QCOMPARE(groups.at(2).second.toString(), QStringLiteral("Recently Saved"));
- QCOMPARE(groups.at(3).first, 9);
+ QCOMPARE(groups.at(3).first, expectedGroupSize + 4);
QCOMPARE(groups.at(3).second.toString(), QStringLiteral("Search For"));
- QCOMPARE(groups.at(4).first, 13);
+ QCOMPARE(groups.at(4).first, expectedGroupSize + 8);
QCOMPARE(groups.at(4).second.toString(), QStringLiteral("Devices"));
- QCOMPARE(groups.at(5).first, 14);
+ QCOMPARE(groups.at(5).first, expectedGroupSize + 9);
QCOMPARE(groups.at(5).second.toString(), QStringLiteral("Removable Devices"));
}