void testLeafActivationUpdatesModel()
{
m_resultsView->setActiveScope("mock-scope-departments");
m_resultsView->setQuery("");
auto books = m_resultsView->browseDepartment("books");
QCOMPARE(m_resultsView->departmentId(), string("books"));
QVERIFY(!books.isRoot());
QVERIFY_MATCHRESULT(
shm::CategoryListMatcher()
.hasAtLeast(1)
.mode(shm::CategoryListMatcher::Mode::starts_with)
.category(shm::CategoryMatcher("cat1")
.hasAtLeast(1)
.mode(shm::CategoryMatcher::Mode::starts_with)
.result(shm::ResultMatcher("test:uri")
.title("result for: \"\", department \"books\"")
)
)
.match(m_resultsView->categories())
);
auto booksAudio = m_resultsView->browseDepartment("books-audio");
QVERIFY(!booksAudio.isRoot());
QVERIFY_MATCHRESULT(
shm::CategoryListMatcher()
.hasAtLeast(1)
.mode(shm::CategoryListMatcher::Mode::starts_with)
.category(shm::CategoryMatcher("cat1")
.hasAtLeast(1)
.mode(shm::CategoryMatcher::Mode::starts_with)
.result(shm::ResultMatcher("test:uri")
.title("result for: \"\", department \"books-audio\"")
)
)
.match(m_resultsView->categories())
);
QVERIFY_MATCHRESULT(
shm::DepartmentMatcher()
.mode(shm::DepartmentMatcher::Mode::by_id)
.child(shm::ChildDepartmentMatcher("books-audio"))
.match(books)
);
}