Skip to content

Commit

Permalink
Changes: Unit test cleanups
Browse files Browse the repository at this point in the history
RevBy: TrustMe
  • Loading branch information
Vesa Halttunen committed Jun 9, 2011
1 parent 9a7427d commit aac785a
Show file tree
Hide file tree
Showing 73 changed files with 510 additions and 636 deletions.
8 changes: 4 additions & 4 deletions src/extensions/screenlock/unlockarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class UnlockArea : public MStylableWidget
private:
void updateState();

MWidget *m_unlock_icon;
bool m_enabled;
bool m_active;
MWidget *m_unlock_icon;
bool m_enabled;
bool m_active;

#ifdef UNIT_TEST
friend class ut_unlockarea;
friend class Ut_UnlockArea;
#endif
};

Expand Down
108 changes: 49 additions & 59 deletions src/systemui/batterybusinesslogic.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary (-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of systemui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary (-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of systemui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef BATTERYBUSINESSLOGIC_H
#define BATTERYBUSINESSLOGIC_H

#include <QObject>
#include <QTime>

#ifdef HAVE_QMSYSTEM
#include <qmled.h>
#include <qmbattery.h>
#include <qmdevicemode.h>
#include <qmdisplaystate.h>
#include <qmled.h>
#include <qmbattery.h>
#include <qmdevicemode.h>
#include <qmdisplaystate.h>
#endif

class QTimer;
Expand All @@ -38,34 +38,33 @@ class MNotification;
* not generate new notifications. The BatteryBusinessLogic will connect to this
* signal and handle the notifications.
*/
class LowBatteryNotifier : public QObject
{
class LowBatteryNotifier: public QObject {
Q_OBJECT

public:
LowBatteryNotifier (QObject* parent = 0);
virtual ~LowBatteryNotifier ();
LowBatteryNotifier(QObject* parent = 0);
virtual ~LowBatteryNotifier();

public slots:
void showLowBatteryNotification ();
void showLowBatteryNotification();

private slots:
#ifdef HAVE_QMSYSTEM
void displayStateChanged (MeeGo::QmDisplayState::DisplayState state);
#endif

signals:
void lowBatteryAlert ();
void lowBatteryAlert();

private:
#ifdef HAVE_QMSYSTEM
MeeGo::QmDisplayState *m_Display;
MeeGo::QmDisplayState *m_Display;
#endif
QTimer *m_Timer;
QTime m_Time;
bool m_Sleep;
int m_ActiveInterval;
int m_InactiveInterval;
QTimer *m_Timer;
QTime m_Time;
bool m_Sleep;
int m_ActiveInterval;
int m_InactiveInterval;

#ifdef UNIT_TEST
friend class Ut_LowBatteryNotifier;
Expand All @@ -75,13 +74,12 @@ private slots:
/*!
* Implements the configuration and state for the battery, the power save mode.
*/
class BatteryBusinessLogic : public QObject
{
class BatteryBusinessLogic : public QObject {
Q_OBJECT

public:
BatteryBusinessLogic (QObject* parent = 0);
virtual ~BatteryBusinessLogic ();
BatteryBusinessLogic(QObject* parent = 0);
virtual ~BatteryBusinessLogic();

typedef enum {
NotificationCharging,
Expand All @@ -92,22 +90,19 @@ class BatteryBusinessLogic : public QObject
NotificationEnteringPSM,
NotificationExitingPSM,
NotificationLowBattery,
NotificationNoEnoughPower,
NotificationNoEnoughPower
} NotificationID;

signals:
/*
* To simplify the test case we use this signal that we can catch. See
* NB#171466 for further details.
*/
void notificationSent (
QString eventType,
QString text,
QString icon);
void notificationSent(QString eventType, QString text, QString icon);

public slots:
void initBattery ();
void lowBatteryAlert ();
void initBattery();
void lowBatteryAlert();

private slots:
#ifdef HAVE_QMSYSTEM
Expand All @@ -116,24 +111,21 @@ private slots:
void batteryChargerEvent (MeeGo::QmBattery::ChargerType type);
void devicePSMStateChanged (MeeGo::QmDeviceMode::PSMState PSMState);
#endif
void utiliseLED (bool activate, const QString &pattern);
void utiliseLED(bool activate, const QString &pattern);

private:
void sendNotification (BatteryBusinessLogic::NotificationID id);
void sendNotification (
const QString &eventType,
const QString &text,
const QString &icon = QString(""));
void sendNotification(BatteryBusinessLogic::NotificationID id);
void sendNotification(const QString &eventType, const QString &text, const QString &icon = QString(""));
void removeNotification(const QString &eventType);
QString chargingImageId ();
QString chargingImageId();

LowBatteryNotifier *m_LowBatteryNotifier;
MNotification *m_notification;
LowBatteryNotifier *m_LowBatteryNotifier;
MNotification *m_notification;
#ifdef HAVE_QMSYSTEM
MeeGo::QmBattery *m_Battery;
MeeGo::QmDeviceMode *m_DeviceMode;
MeeGo::QmLED *m_Led;
MeeGo::QmBattery::ChargerType m_ChargerType;
MeeGo::QmBattery *m_Battery;
MeeGo::QmDeviceMode *m_DeviceMode;
MeeGo::QmLED *m_Led;
MeeGo::QmBattery::ChargerType m_ChargerType;
#endif

#ifdef UNIT_TEST
Expand All @@ -142,6 +134,4 @@ private slots:
#endif
};


#endif

3 changes: 2 additions & 1 deletion src/systemui/diskspacenotifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#ifndef DISKSPACENOTIFIER_H_
#define DISKSPACENOTIFIER_H_

#include <QSet>
#include <QObject>
#include <QMap>
#include <QPair>

class MNotification;

Expand Down
18 changes: 7 additions & 11 deletions src/systemui/shutdownbusinesslogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,28 @@ class ShutdownUI;
* \brief Business logic for the shutdown subsystem.
*
* This class connects the systemStateChanged() signal of the QmSystem library
* and notify the user about the state changes. The class does nothing else.
* The messages are sent, when:
* and notify the user about the state changes. The messages are sent, when:
* 1) Shutdown is happening.
* 2) Thermal emergency shutdown is happening.
* 3) Battery low shutdown is happening.
* 4) The shutdown is aborted because the USB is connected.
*
*/
class ShutdownBusinessLogic : public QObject
{
Q_OBJECT

public:
ShutdownBusinessLogic(QObject *parent = 0);
virtual ~ShutdownBusinessLogic ();
virtual ~ShutdownBusinessLogic();

void showUI(QString text1 = QString (""), QString text2 = QString (""), int timeout = 2000);
void showUI(QString text1 = QString(), QString text2 = QString(), int timeout = 2000);

public slots:
#ifdef HAVE_QMSYSTEM
/*!
* This function is called when the QmSystem reports a state change.
*/
void systemStateChanged (MeeGo::QmSystemState::StateIndication what);
void systemStateChanged(MeeGo::QmSystemState::StateIndication what);
#endif

private:
Expand All @@ -69,7 +67,7 @@ public slots:
ShutdownUI *shutdownUi;

#ifdef HAVE_QMSYSTEM
MeeGo::QmSystemState *m_State;
MeeGo::QmSystemState *m_State;
#endif

#ifdef UNIT_TEST
Expand All @@ -84,12 +82,10 @@ class ShutdownBusinessLogicAdaptor : public QDBusAbstractAdaptor
Q_CLASSINFO("D-Bus Interface", "com.nokia.systemui.shutdownui")

public:
ShutdownBusinessLogicAdaptor (
QObject *parent,
ShutdownBusinessLogic *logic);
ShutdownBusinessLogicAdaptor(QObject *parent, ShutdownBusinessLogic *logic);

public slots:
Q_NOREPLY void showScreen (QString text1, QString text2, int timeout);
Q_NOREPLY void showScreen(QString text1, QString text2, int timeout);

private:
ShutdownBusinessLogic *shutdownBusinessLogic;
Expand Down
Loading

0 comments on commit aac785a

Please sign in to comment.