on xenial help sign in
Extended LauncherModel unit-test, ensured that dataChanged signal is triggered.
commit33c14b3749d652e199f13f64960826016039f988 authorMirco Müller <mirco.mueller@ubuntu.com> dateThu 25 Jun 2015, 11:54 (11 years ago) parent4322450
3 files changed+7−3
plugins/Unity/Launcher/launcheritem.cpp+1−1 plugins/Unity/Launcher/launchermodel.cpp+2−2 tests/plugins/Unity/Launcher/launchermodeltest.cpp+4
plugins/Unity/Launcher/launcheritem.cpp+1−1
@@ -176,7 +176,7 @@ void LauncherItem::setFocused(bool focused)
176176{
177177 if (m_focused != focused) {
178178 m_focused = focused;
179− if (!focused) {
179+ if (focused) {
180180 setAlerting(false);
181181 }
182182 Q_EMIT focusedChanged(focused);
plugins/Unity/Launcher/launchermodel.cpp+2−2
@@ -349,7 +349,7 @@ void LauncherModel::countChanged(const QString &appId, int count)
349349 LauncherItem *item = m_list.at(idx);
350350 item->setCount(count);
351351 if (item->countVisible()) {
352− item->setAlerting(true);
352+ setAlerting(item->appId(), true);
353353 }
354354 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
355355 m_asAdapter->syncItems(m_list);
@@ -363,7 +363,7 @@ void LauncherModel::countVisibleChanged(const QString &appId, int countVisible)
363363 LauncherItem *item = m_list.at(idx);
364364 item->setCountVisible(countVisible);
365365 if (countVisible) {
366− item->setAlerting(true);
366+ setAlerting(item->appId(), true);
367367 }
368368 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCountVisible);
369369
tests/plugins/Unity/Launcher/launchermodeltest.cpp+4
@@ -368,6 +368,8 @@ private Q_SLOTS:
368368 }
369369
370370 void testCountEmblems() {
371+ QSignalSpy spy(launcherModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
372+
371373 // Call GetAll on abs-icon
372374 QDBusInterface interface("com.canonical.Unity.Launcher", "/com/canonical/Unity/Launcher/abs_2Dicon", "org.freedesktop.DBus.Properties");
373375 QDBusReply<QVariantMap> reply = interface.call("GetAll");
@@ -398,9 +400,11 @@ private Q_SLOTS:
398400 QCOMPARE(index >= 0, true);
399401
400402 // And make sure values have changed there as well
403+ spy.clear();
401404 QCOMPARE(launcherModel->get(index)->countVisible(), true);
402405 QCOMPARE(launcherModel->get(index)->count(), 55);
403406 QVERIFY(launcherModel->get(index)->alerting() == true);
407+ QCOMPARE(spy.at(0).at(2).value<QVector<int>>().first(), (int)LauncherModelInterface::RoleAlerting);
404408 }
405409
406410 void testCountEmblemAddsRemovesItem_data() {