calendarui/views/dayview/tsrc/unittests/unittest_calendayeventspane/unittest_calendayeventspane.cpp
author hgs
Mon, 28 Jun 2010 15:22:02 +0530
changeset 45 b6db4fd4947b
child 55 2c54b51f39c4
permissions -rw-r--r--
201025

/*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description: Test class for CalenDayContentWidget
 *
 */
#include <QGraphicsItem>
#include <QtTest/QtTest>
#include <QPen>

#include "calendayeventspane.h"

class TestCalenEventsPane : public QObject
{
Q_OBJECT

public:
    TestCalenEventsPane();
    virtual ~TestCalenEventsPane();

private slots:
    void initTestCase();
    void cleanupTestCase();
    void init();
    void cleanup();

    void testConstructors();

private:
    CalenDayEventsPane *mEventsPane;
};

/*!
 Constructor
 */
TestCalenEventsPane::TestCalenEventsPane() :
   mEventsPane(NULL)
{

}

/*!
 Destructor
 */
TestCalenEventsPane::~TestCalenEventsPane()
{

}

/*!
 Called before testcase
 */
void TestCalenEventsPane::initTestCase()
{
}

/*!
 Called after testcase
 */
void TestCalenEventsPane::cleanupTestCase()
{

}

/*!
 Called before every function
 */
void TestCalenEventsPane::init()
{
    mEventsPane = new CalenDayEventsPane();
}

/*!
 Called after everyfunction
 */
void TestCalenEventsPane::cleanup()
{
    if (mEventsPane) {
        delete mEventsPane;
        mEventsPane = NULL;
    }
}

/*!
 Test function for constructors
 1. Test if events pane is not initialized
 2. Test if events pane is correcty created
 */
void TestCalenEventsPane::testConstructors()
{
    //1)
    CalenDayEventsPane *testEventsPane = 0;
    QVERIFY(!testEventsPane);
    
    //2)
    testEventsPane = new CalenDayEventsPane();
    QVERIFY(testEventsPane);
    delete testEventsPane;
}

QTEST_MAIN(TestCalenEventsPane);
#include "unittest_calendayeventspane.moc"