Skip to content

Commit

Permalink
Fixes: NB#272833 - [TASK] when the call is active and battery is low,…
Browse files Browse the repository at this point in the history
… alert user at every 2 min interval regardless of display states

Bug: NB#272833 - [TASK] when the call is active and battery is low, alert user at every 2 min interval regardless of display states
RevBy: Urho Konttori, Pankaj Saharan
  • Loading branch information
Vesa Halttunen committed Sep 19, 2011
1 parent a7a92b6 commit 1f4ce43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/systemui/lowbatterynotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void LowBatteryNotifier::sendLowBatteryAlert()
void LowBatteryNotifier::setNotificationInterval()
{
bool deviceCurrentlyInactive = touchScreenLockActive;
bool callCurrentlyActive = callContextItem->value().toBool();
bool callCurrentlyActive = callContextItem->value().toString() == "active";

#ifdef HAVE_QMSYSTEM
// Device can be considered inactive only if the touch screen lock is active AND the display is off
Expand Down
8 changes: 4 additions & 4 deletions tests/ut_lowbatterynotifier/ut_lowbatterynotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void Ut_LowBatteryNotifier::init()
{
contextItem = new ContextFrameworkItem(QString());
gContextFrameworkContextStub->stubSetReturnValue("createContextItem", static_cast<ContextItem *>(contextItem));
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant(false));
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant("inactive"));
m_subject = new LowBatteryNotifier;
}

Expand Down Expand Up @@ -138,15 +138,15 @@ void Ut_LowBatteryNotifier::testSetNotificationInterval()
#ifdef HAVE_QMSYSTEM
gQmDisplayStateStub->stubSetReturnValue("get", displayState == MeeGo::QmDisplayState::On ? MeeGo::QmDisplayState::Off : MeeGo::QmDisplayState::On);
#endif
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant(!callActive));
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant(callActive ? "inactive" : "active"));
m_subject->setTouchScreenLockActive(!touchScreenLockActive);

// Set the values according to the test data and verify
QSignalSpy spy(m_subject, SIGNAL(lowBatteryAlert()));
#ifdef HAVE_QMSYSTEM
gQmDisplayStateStub->stubSetReturnValue("get", displayState);
#endif
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant(callActive));
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant(callActive ? "active" : "inactive"));
qTimeElapsed = timeSincePreviousNotification;
m_subject->setTouchScreenLockActive(touchScreenLockActive);
QCOMPARE(m_subject->notificationTimer->interval(), notificationTimerInterval);
Expand All @@ -159,7 +159,7 @@ void Ut_LowBatteryNotifier::testSetNotificationIntervalDoesNothingWhenStateDoesN
#ifdef HAVE_QMSYSTEM
gQmDisplayStateStub->stubSetReturnValue("get", MeeGo::QmDisplayState::On);
#endif
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant(false));
gContextFrameworkItemStub->stubSetReturnValue("value", QVariant("inactive"));
qTimeElapsed = 0;
m_subject->setTouchScreenLockActive(false);

Expand Down

0 comments on commit 1f4ce43

Please sign in to comment.