diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-04-17 08:38:57 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-04-17 09:26:06 +0000 |
commit | ec4c8d4a75a811d5440a297df0d7c6ebb7d56522 (patch) | |
tree | 721a5e9be435623ed8f6c86b0c5c16b6faa3bd66 | |
parent | 2f10ddd3dd76e1bea676714bdf59d6e9884d2317 (diff) |
Fix incomplete category hierarchy in Here plugin
The recent addition of a second level of categories failed to
set the parent cat id for each child.
Change-Id: Ib30050463b84c2f62972082c0a883bb96bc89c52
Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r-- | src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp | 1 | ||||
-rw-r--r-- | tests/auto/nokia_services/places_semiauto/tst_places.cpp | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp index c94ea390..52a3eaaf 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp @@ -606,6 +606,7 @@ QPlaceReply *QPlaceManagerEngineNokiaV2::initializeCategories() if (m_tempTree.contains(parentCategoryId)) { PlaceCategoryNode node; node.category.setCategoryId(subCategoryId); + node.parentId = parentCategoryId; // find parent PlaceCategoryNode &parent = m_tempTree[parentCategoryId]; diff --git a/tests/auto/nokia_services/places_semiauto/tst_places.cpp b/tests/auto/nokia_services/places_semiauto/tst_places.cpp index be939e35..9fe564b5 100644 --- a/tests/auto/nokia_services/places_semiauto/tst_places.cpp +++ b/tests/auto/nokia_services/places_semiauto/tst_places.cpp @@ -436,10 +436,17 @@ void tst_QPlaceManagerNokia::categories() //check we can retrieve the very same category by id QCOMPARE(placeManager->category(category.categoryId()), category); - //since the here plugin only supports a single level category tree - //check that there are no parent or children categories + //the here plugin supports a two-level level category tree QVERIFY(placeManager->parentCategoryId(category.categoryId()).isEmpty()); - QVERIFY(placeManager->childCategories(category.categoryId()).isEmpty()); + const QList<QPlaceCategory> childCats = + placeManager->childCategories(category.categoryId()); + if (!childCats.isEmpty()) { + foreach (const QPlaceCategory &child, childCats) { + // only two levels of categories hence 2.nd level has no further children + QVERIFY(placeManager->childCategories(child.categoryId()).isEmpty()); + QVERIFY(placeManager->parentCategoryId(child.categoryId()) == category.categoryId()); + } + } } } |