void testFilterCategory() { //test category matches QLandmarkCategoryFilter categoryFilter; QLandmarkCategoryId catFilterId; catFilterId.setLocalId("1"); catFilterId.setManagerUri("qtlandmarks:mock:"); categoryFilter.setCategoryId(catFilterId); QLandmark lm; QLandmarkCategoryId lmCatId; lmCatId.setLocalId("1"); lmCatId.setManagerUri("qtlandmarks:mock:"); lm.addCategoryId(lmCatId); QVERIFY(MockEngine::testFilter(categoryFilter,lm)); //test category id doesn't match lm.removeCategoryId(lmCatId); QVERIFY(lm.categoryIds().count() == 0); lmCatId.setLocalId("2"); lm.addCategoryId(lmCatId); QVERIFY(!MockEngine::testFilter(categoryFilter,lm)); //test category uri that doesn't match QList<QLandmarkCategoryId> catIdList; lm.setCategoryIds(catIdList); QVERIFY(lm.categoryIds().count() == 0); lmCatId.setLocalId("1"); lmCatId.setManagerUri("qtlandmarks:fake:"); catIdList.append(lmCatId); lm.setCategoryIds(catIdList); QVERIFY(lm.categoryIds().count() == 1); QVERIFY(!MockEngine::testFilter(categoryFilter,lm)); //try match a category when the //landmark has multiple categories QLandmarkCategoryId lmCatId2; QLandmarkCategoryId lmCatId3; lmCatId.setLocalId("1"); lmCatId.setManagerUri("qtlandmarks:mock:"); lmCatId2.setLocalId("2"); lmCatId2.setManagerUri("qtlandmarks:mock:"); lmCatId3.setLocalId("3"); lmCatId3.setManagerUri("qtlandmarks:mock:"); catIdList.clear(); catIdList << lmCatId << lmCatId2 << lmCatId3; lm.setCategoryIds(catIdList); catFilterId.setLocalId("2"); catFilterId.setManagerUri("qtlandmarks:mock:"); categoryFilter.setCategoryId(catFilterId); QVERIFY(MockEngine::testFilter(categoryFilter, lm)); //category id doesn't match when the landmark //has multipl catgories catFilterId.setLocalId("4"); categoryFilter.setCategoryId(catFilterId); }