on xenial help sign in
Extended LauncherModel unit-test, ensured that dataChanged signal is triggered.
33c14b3Mirco Müller
plugins/Unity/Launcher/launcheritem.cpp+1−1
@@ -176,7 +176,7 @@ void LauncherItem::setFocused(bool focused)
176{
176{
177 if (m_focused != focused) {
177 if (m_focused != focused) {
178 m_focused = focused;
178 m_focused = focused;
179− if (!focused) {
179+ if (focused) {
180 setAlerting(false);
180 setAlerting(false);
181 }
181 }
182 Q_EMIT focusedChanged(focused);
182 Q_EMIT focusedChanged(focused);
plugins/Unity/Launcher/launchermodel.cpp+2−2
@@ -349,7 +349,7 @@ void LauncherModel::countChanged(const QString &appId, int count)
349 LauncherItem *item = m_list.at(idx);
349 LauncherItem *item = m_list.at(idx);
350 item->setCount(count);
350 item->setCount(count);
351 if (item->countVisible()) {
351 if (item->countVisible()) {
352− item->setAlerting(true);
352+ setAlerting(item->appId(), true);
353 }
353 }
354 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
354 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
355 m_asAdapter->syncItems(m_list);
355 m_asAdapter->syncItems(m_list);
@@ -363,7 +363,7 @@ void LauncherModel::countVisibleChanged(const QString &appId, int countVisible)
363 LauncherItem *item = m_list.at(idx);
363 LauncherItem *item = m_list.at(idx);
364 item->setCountVisible(countVisible);
364 item->setCountVisible(countVisible);
365 if (countVisible) {
365 if (countVisible) {
366− item->setAlerting(true);
366+ setAlerting(item->appId(), true);
367 }
367 }
368 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCountVisible);
368 Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCountVisible);
369
369
tests/plugins/Unity/Launcher/launchermodeltest.cpp+4
@@ -368,6 +368,8 @@ private Q_SLOTS:
368 }
368 }
369
369
370 void testCountEmblems() {
370 void testCountEmblems() {
371+ QSignalSpy spy(launcherModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
372+
371 // Call GetAll on abs-icon
373 // Call GetAll on abs-icon
372 QDBusInterface interface("com.canonical.Unity.Launcher", "/com/canonical/Unity/Launcher/abs_2Dicon", "org.freedesktop.DBus.Properties");
374 QDBusInterface interface("com.canonical.Unity.Launcher", "/com/canonical/Unity/Launcher/abs_2Dicon", "org.freedesktop.DBus.Properties");
373 QDBusReply<QVariantMap> reply = interface.call("GetAll");
375 QDBusReply<QVariantMap> reply = interface.call("GetAll");
@@ -398,9 +400,11 @@ private Q_SLOTS:
398 QCOMPARE(index >= 0, true);
400 QCOMPARE(index >= 0, true);
399
401
400 // And make sure values have changed there as well
402 // And make sure values have changed there as well
403+ spy.clear();
401 QCOMPARE(launcherModel->get(index)->countVisible(), true);
404 QCOMPARE(launcherModel->get(index)->countVisible(), true);
402 QCOMPARE(launcherModel->get(index)->count(), 55);
405 QCOMPARE(launcherModel->get(index)->count(), 55);
403 QVERIFY(launcherModel->get(index)->alerting() == true);
406 QVERIFY(launcherModel->get(index)->alerting() == true);
407+ QCOMPARE(spy.at(0).at(2).value<QVector<int>>().first(), (int)LauncherModelInterface::RoleAlerting);
404 }
408 }
405
409
406 void testCountEmblemAddsRemovesItem_data() {
410 void testCountEmblemAddsRemovesItem_data() {