calendarui/views/dayview/tsrc/unittests/unittest_calendayview/unittest_calendayview.cpp
changeset 45 b6db4fd4947b
child 57 bb2d3e476f29
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
       
     1 /*
       
     2  * Copyright (c) 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 class for CalenDayContainerWidget
       
    15  *
       
    16  */
       
    17 #include <QtTest/QtTest>
       
    18 
       
    19 #include "calenservices.h"
       
    20 #include "calendateutils.h"
       
    21 #include "calendaymodelmanager.h"
       
    22 #include "calendayview.h"
       
    23 
       
    24 class TestCalenDayView : public QObject
       
    25 {
       
    26 Q_OBJECT
       
    27 
       
    28 public:
       
    29     TestCalenDayView();
       
    30     virtual ~TestCalenDayView();
       
    31 
       
    32 private slots:
       
    33     void initTestCase();
       
    34     void cleanupTestCase();
       
    35     void init();
       
    36     void cleanup();
       
    37 
       
    38     void testConstructors();
       
    39 
       
    40 private:
       
    41     CalenDayView *mView;
       
    42 };
       
    43 
       
    44 /*!
       
    45  Constructor
       
    46  */
       
    47 TestCalenDayView::TestCalenDayView() :
       
    48 	mView(NULL)
       
    49 {
       
    50 
       
    51 }
       
    52 
       
    53 /*!
       
    54  Destructor
       
    55  */
       
    56 TestCalenDayView::~TestCalenDayView()
       
    57 {
       
    58 
       
    59 }
       
    60 
       
    61 /*!
       
    62  Called before testcase
       
    63  */
       
    64 void TestCalenDayView::initTestCase()
       
    65 {
       
    66 }
       
    67 
       
    68 /*!
       
    69  Called after testcase
       
    70  */
       
    71 void TestCalenDayView::cleanupTestCase()
       
    72 {
       
    73 
       
    74 }
       
    75 
       
    76 /*!
       
    77  Called before every function
       
    78  */
       
    79 void TestCalenDayView::init()
       
    80 {
       
    81 
       
    82 }
       
    83 
       
    84 /*!
       
    85  Called after everyfunction
       
    86  */
       
    87 void TestCalenDayView::cleanup()
       
    88 {
       
    89 
       
    90 }
       
    91 
       
    92 void TestCalenDayView::testConstructors()
       
    93 {
       
    94 	MCalenServices services;
       
    95     //1)
       
    96     CalenDayView *testView = 0;
       
    97     QVERIFY(!testView);
       
    98     
       
    99     //2)
       
   100     testView = new CalenDayView(services);
       
   101     QVERIFY(testView);
       
   102     
       
   103     delete testView;
       
   104 }
       
   105 
       
   106 int main(int argc, char ** argv)
       
   107 
       
   108 {
       
   109 
       
   110 argc++;
       
   111 
       
   112 argc++;
       
   113 
       
   114 char * argvNew[3];
       
   115 
       
   116 argvNew[0]= argv[0];
       
   117 
       
   118 argvNew[1]= const_cast<char*>("-o");
       
   119 
       
   120 argvNew[2]= const_cast<char*>("c:\\unittest\\TestCalenDayView.txt");//set place where //output chould be
       
   121 
       
   122 QApplication app(argc, argvNew);
       
   123 
       
   124 TestCalenDayView testFile;//file with class containing unit tests
       
   125 
       
   126 QTest::qExec(&testFile,argc,argvNew);
       
   127 
       
   128 }
       
   129 #include "unittest_calendayview.moc"