|
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: |
|
15 * test application for qt control panel public apis. |
|
16 */ |
|
17 |
|
18 #include "ut_cppluginutility.h" |
|
19 |
|
20 #include <QtTest/QtTest> |
|
21 #include <hbdataform.h> |
|
22 #include <cppluginutility.h> |
|
23 |
|
24 /*! |
|
25 \class TestCpPluginUtility |
|
26 \brief This class is used for the unit test for class CpPluginUtility.\n |
|
27 CpPluginUtility class is a utility class used to provide method to add 2 two new customed prototype into the HbDataForm object. \n |
|
28 This unit test is supported by QTest. |
|
29 There are total 2 test cases in this unit. |
|
30 */ |
|
31 |
|
32 void TestCpPluginUtility::initTestCase() |
|
33 { |
|
34 } |
|
35 |
|
36 void TestCpPluginUtility::cleanupTestCase() |
|
37 { |
|
38 QCoreApplication::processEvents(); |
|
39 } |
|
40 |
|
41 /*! |
|
42 * Test Case Description:\n |
|
43 * 1. Fucntion Name: addCpItemPrototype() \n |
|
44 2. Function Descrition: \n |
|
45 add 2 new prototype to a HbDataForm object.\n |
|
46 3. Input Parameters: \n |
|
47 @param: HbDataForm *settingForm\n |
|
48 4. Expected result: \n |
|
49 case run without verify failed.\n |
|
50 */ |
|
51 void TestCpPluginUtility::testAddCpItemPrototypeWithDataForm() |
|
52 { |
|
53 HbDataForm * settingForm = new HbDataForm(); |
|
54 QVERIFY(settingForm != 0); |
|
55 |
|
56 int count0 = settingForm->itemPrototypes().count(); |
|
57 CpPluginUtility::addCpItemPrototype(settingForm); |
|
58 int count1 = settingForm->itemPrototypes().count(); |
|
59 QVERIFY(count0 + 2 == count1); |
|
60 |
|
61 delete settingForm; |
|
62 } |
|
63 |
|
64 /*! |
|
65 * Test Case Description:\n |
|
66 * 1. Fucntion Name: addCpItemPrototype() \n |
|
67 2. Function Descrition: \n |
|
68 add 2 new prototype to a HbDataForm object.\n |
|
69 3. Input Parameters: \n |
|
70 @param: 0.\n |
|
71 4. Expected result: \n |
|
72 case run without verify failed.\n |
|
73 */ |
|
74 void TestCpPluginUtility::testAddCpItemPrototypeWithNullPointer() |
|
75 { |
|
76 CpPluginUtility::addCpItemPrototype(0); |
|
77 } |
|
78 |
|
79 QTEST_MAIN(TestCpPluginUtility) |