homescreenapp/widgetplugins/hsclockwidgetplugin/tsrc/t_hsclockwidgetplugin/src/t_hsdigitalclockwidget.cpp
changeset 96 458d8c8d9580
equal deleted inserted replaced
92:6727c5d0afc7 96:458d8c8d9580
       
     1 /*
       
     2 * Copyright (c) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  test code
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <QtTest/QtTest>
       
    21 
       
    22 #include <QGraphicsSceneResizeEvent>
       
    23 #include "t_hsclockwidget.h"
       
    24 #include "hsdigitalclockwidget.h"
       
    25 #include "hsclockwidgettimer.h"
       
    26 
       
    27 
       
    28 
       
    29 void TestClockWidget::createDigitalClockWidget()
       
    30 {
       
    31     HsDigitalClockWidget *clock = new HsDigitalClockWidget();
       
    32     QVERIFY(clock);
       
    33 
       
    34     QVERIFY(clock->mBackground);
       
    35     QVERIFY(clock->mDigit1);
       
    36     QVERIFY(clock->mDigit2);
       
    37     QVERIFY(clock->mDigit3);
       
    38     QVERIFY(clock->mDigit4);
       
    39     QVERIFY(clock->mDigit5);
       
    40     QVERIFY(clock->mDigit6);
       
    41 
       
    42     QGraphicsSceneResizeEvent event;
       
    43     clock->resizeEvent(&event);
       
    44 
       
    45     delete clock;
       
    46 }
       
    47 
       
    48 void TestClockWidget::digitalClockWidgetTick()
       
    49 {
       
    50     HsDigitalClockWidget *clock = new HsDigitalClockWidget(false);
       
    51     clock->tick();
       
    52     clock->setAmPm(true);
       
    53     clock->setAmPm(false);
       
    54     clock->setAmPm(false);
       
    55     delete clock;
       
    56 }
       
    57 
       
    58 void TestClockWidget::digitalClockWidgetPolish()
       
    59 {
       
    60     HsDigitalClockWidget *clock = new HsDigitalClockWidget();
       
    61     HbStyleParameters params;
       
    62     clock->polish(params);
       
    63     HbIconItem *iconItem=static_cast<HbIconItem*>(clock->mDigit2);
       
    64     QVERIFY(iconItem);
       
    65     delete clock;
       
    66 }
       
    67 
       
    68 void TestClockWidget::digitalClockWidgetShape()
       
    69 {
       
    70     HsDigitalClockWidget *clock = new HsDigitalClockWidget();
       
    71     QPainterPath path = clock->shape();
       
    72     delete clock;
       
    73 }
       
    74 
       
    75 void TestClockWidget::testHsClockWidgetTimer()
       
    76 {
       
    77     HsClockWidgetTimer timer;
       
    78 }