Skip to content

Commit

Permalink
[lipstick] Remove x-nemo-led-disabled-without-body-and-summary notifi…
Browse files Browse the repository at this point in the history
…cation hint. JB#50445
  • Loading branch information
Bea Lam committed Jul 23, 2020
1 parent 1bb4bd0 commit 8235684
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 30 deletions.
1 change: 0 additions & 1 deletion src/notifications/lipsticknotification.cpp
Expand Up @@ -43,7 +43,6 @@ const char *LipstickNotification::HINT_FEEDBACK = "x-nemo-feedback";
const char *LipstickNotification::HINT_HIDDEN = "x-nemo-hidden";
const char *LipstickNotification::HINT_DISPLAY_ON = "x-nemo-display-on";
const char *LipstickNotification::HINT_SUPPRESS_DISPLAY_ON = "x-nemo-suppress-display-on";
const char *LipstickNotification::HINT_LED_DISABLED_WITHOUT_BODY_AND_SUMMARY = "x-nemo-led-disabled-without-body-and-summary";
const char *LipstickNotification::HINT_ORIGIN = "x-nemo-origin";
const char *LipstickNotification::HINT_ORIGIN_PACKAGE = "x-nemo-origin-package";
const char *LipstickNotification::HINT_OWNER = "x-nemo-owner";
Expand Down
3 changes: 0 additions & 3 deletions src/notifications/lipsticknotification.h
Expand Up @@ -123,9 +123,6 @@ class LIPSTICK_EXPORT LipstickNotification : public QObject
//! Nemo hint: Even if priority suggests it, do not turn display on
static const char *HINT_SUPPRESS_DISPLAY_ON;

//! Nemo hint: Whether to disable LED feedbacks when there is no body and summary
static const char *HINT_LED_DISABLED_WITHOUT_BODY_AND_SUMMARY;

//! Nemo hint: Indicates the origin of the notification
static const char *HINT_ORIGIN;

Expand Down
3 changes: 1 addition & 2 deletions src/notifications/notificationfeedbackplayer.cpp
Expand Up @@ -63,8 +63,7 @@ void NotificationFeedbackPlayer::addNotification(uint id)
const QStringList feedbackItems = feedback.split(QStringLiteral(","), QString::SkipEmptyParts);
if (isEnabled(notification, m_minimumPriority) && !feedbackItems.isEmpty()) {
QMap<QString, QVariant> properties;
if (notification->hints().value(LipstickNotification::HINT_LED_DISABLED_WITHOUT_BODY_AND_SUMMARY, true).toBool() &&
notification->body().isEmpty() &&
if (notification->body().isEmpty() &&
notification->summary().isEmpty()) {
properties.insert("media.leds", false);
}
Expand Down
Expand Up @@ -378,26 +378,11 @@ void Ut_NotificationFeedbackPlayer::testNotificationPriority()
QCOMPARE(gClientStub->stubCallCount("play"), playCount);
}

void Ut_NotificationFeedbackPlayer::testLEDDisabledWhenNoSummaryAndBody_data()
{
QTest::addColumn<QVariant>("disableHint");
QTest::addColumn<bool>("mediaParametersDefined");

QTest::newRow("LED disabled without body and summary not defined") << QVariant() << true;
QTest::newRow("LED disabled without body and summary false") << QVariant(false) << false;
QTest::newRow("LED disabled without body and summary true") << QVariant(true) << true;
}

void Ut_NotificationFeedbackPlayer::testLEDDisabledWhenNoSummaryAndBody()
{
QFETCH(QVariant, disableHint);
QFETCH(bool, mediaParametersDefined);

QVariantHash hints;
hints.insert(LipstickNotification::HINT_FEEDBACK, "feedback");
if (disableHint.isValid()) {
hints.insert(LipstickNotification::HINT_LED_DISABLED_WITHOUT_BODY_AND_SUMMARY, disableHint);
}

LipstickNotification *notification1 = new LipstickNotification("ut_notificationfeedbackplayer", "", 1, "", "", "", QStringList(), hints, -1);
LipstickNotification *notification2 = new LipstickNotification("ut_notificationfeedbackplayer", "", 2, "", "summary", "", QStringList(), hints, -1);
LipstickNotification *notification3 = new LipstickNotification("ut_notificationfeedbackplayer", "", 3, "", "", "body", QStringList(), hints, -1);
Expand All @@ -407,13 +392,7 @@ void Ut_NotificationFeedbackPlayer::testLEDDisabledWhenNoSummaryAndBody()

player->addNotification(1);
QCOMPARE(gClientStub->stubCallCount("play"), 1);
QCOMPARE(gClientStub->stubLastCallTo("play").parameter<QVariantMap>(1).contains("media.leds"), mediaParametersDefined);
if (mediaParametersDefined) {
QCOMPARE(gClientStub->stubLastCallTo("play").parameter<QVariantMap>(1).value("media.leds").toBool(), false);
QCOMPARE(gClientStub->stubLastCallTo("play").parameter<QVariantMap>(1).value("media.audio").toBool(), true);
QCOMPARE(gClientStub->stubLastCallTo("play").parameter<QVariantMap>(1).value("media.vibra").toBool(), true);
QCOMPARE(gClientStub->stubLastCallTo("play").parameter<QVariantMap>(1).value("media.backlight").toBool(), true);
}
QCOMPARE(gClientStub->stubLastCallTo("play").parameter<QVariantMap>(1).contains("media.leds"), false);

player->addNotification(2);
QCOMPARE(gClientStub->stubCallCount("play"), 2);
Expand Down
Expand Up @@ -43,7 +43,6 @@ private slots:
void testNotificationPreviewsDisabled();
void testNotificationPriority_data();
void testNotificationPriority();
void testLEDDisabledWhenNoSummaryAndBody_data();
void testLEDDisabledWhenNoSummaryAndBody();

private:
Expand Down

0 comments on commit 8235684

Please sign in to comment.