diff -r 8bda91a87a00 -r 8ee96d21d9bf controlpanel/tsrc/unit/ut_cpsettingformitemdata/src/ut_cpsettingformitemdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controlpanel/tsrc/unit/ut_cpsettingformitemdata/src/ut_cpsettingformitemdata.cpp Tue Aug 31 15:29:50 2010 +0300 @@ -0,0 +1,335 @@ +/* +* 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 application for qt control panel public apis. +*/ + +#include "ut_cpsettingformitemdata.h" + +#include +#include + +/*! + \class TestCpSettingFormItemData + \brief This class is used for the unit test for class CpSettingFormItemData.\n + CpSettingFormItemData class is derived from HbDataFormModelItem, customed model item for control panel.\n + This unit test is supported by QTest.\n + There are total 11 test cases in this unit.\n + */ + +void TestCpSettingFormItemData::initTestCase() + { + } + +void TestCpSettingFormItemData::cleanupTestCase() + { + QCoreApplication::processEvents(); + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeTextItem() + { + CpSettingFormItemData *pdata = new CpSettingFormItemData( HbDataFormModelItem::TextItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::TextItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeSliderItem() + { + CpSettingFormItemData *pdata = new CpSettingFormItemData( HbDataFormModelItem::SliderItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::SliderItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeVolumeSliderItem() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::VolumeSliderItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::VolumeSliderItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeCheckBoxItem() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::CheckBoxItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::CheckBoxItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeToggleValueItem() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::ToggleValueItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::ToggleValueItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeRadioButtonListItem() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::RadioButtonListItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::RadioButtonListItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeMultiselectionItem() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::MultiselectionItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::MultiselectionItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithTypeComboBoxItem() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::ComboBoxItem, "label" ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::ComboBoxItem ); + QVERIFY( pdata->label() == "label"); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithParent() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::SliderItem, "parent", 0 ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::SliderItem ); + + CpSettingFormItemData * cdata = new CpSettingFormItemData( HbDataFormModelItem::TextItem, "label", pdata); + QVERIFY( cdata != 0 ); + QVERIFY( cdata->type() == HbDataFormModelItem::TextItem ); + + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataNoParameter() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData(); + QVERIFY( pdata !=0 ); + pdata->setType(HbDataFormModelItem::SliderItem); + pdata->setLabel("label"); + + QVERIFY( pdata->type() == HbDataFormModelItem::SliderItem ); + delete pdata; + } + +/*! + * Test Case Description:\n   + * 1. Fucntion Name: \n   + CpSettingFormItemData(HbDataFormModelItem::DataItemType type, + const QString &label, + const HbDataFormModelItem *parent = 0);\n  + + 2. Function Descrition: \n    + Construct a new CpSettingFormItemData with the given type,label and parent.\n  + 3. Input Parameters: \n   + HbDataFormModelItem::DataItemType type\n   + QString &label\n   + HbDataFormModelItem *parent\n  + 4. Expected result: \n   + case run without verify failed.\n + */ +void TestCpSettingFormItemData::testCpSettingFormItemDataWithParentNoType() + { + CpSettingFormItemData * pdata = new CpSettingFormItemData( HbDataFormModelItem::SliderItem, "parent", 0 ); + QVERIFY( pdata !=0 ); + QVERIFY( pdata->type() == HbDataFormModelItem::SliderItem ); + + CpSettingFormItemData * cdata = new CpSettingFormItemData(pdata); + QVERIFY( cdata != 0 ); + cdata->setType(HbDataFormModelItem::TextItem); + QVERIFY( cdata->type() == HbDataFormModelItem::TextItem ); + + delete pdata; + } + +QTEST_APPLESS_MAIN(TestCpSettingFormItemData)