controlpanelplugins/themeplugin/tsrc/unit/unittest_cpthemepreview/unittest_cpthemepreview.cpp
branchRCL_3
changeset 13 90fe62538f66
equal deleted inserted replaced
12:3fec62e6e7fc 13:90fe62538f66
       
     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: XENT-MV
       
    13 *
       
    14 * Description:  unit tests for the CpThemePreview class from themeplugin
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QtTest/QtTest>
       
    19 
       
    20 #include "cpthemepreview.h"
       
    21 #include "cpthemechanger.h"
       
    22 #include "cpthemeutil.h"
       
    23 
       
    24 class TestCpThemePreview : public QObject
       
    25 {
       
    26     Q_OBJECT
       
    27 
       
    28 private slots:
       
    29     
       
    30     void testAll();
       
    31     
       
    32 };
       
    33 
       
    34 void TestCpThemePreview::testAll()
       
    35 {
       
    36     QList<QPair<QString, QString> > themes = CpThemeUtil::availableThemes();
       
    37     
       
    38     QPair<QString, QString> pair;
       
    39     
       
    40     pair = themes.at(0);
       
    41     
       
    42     QString name = pair.first;
       
    43     QString themePath = pair.second;
       
    44     CpThemeInfo* themeInfo = CpThemeUtil::buildThemeInfo(themePath, name);
       
    45     
       
    46     CpThemePreview *obj = new CpThemePreview(*themeInfo);
       
    47     
       
    48     
       
    49     QVERIFY (obj != 0 );
       
    50     QCOMPARE(obj->themeName(), name);
       
    51     QCOMPARE(obj->themeIcon(), themeInfo->icon());
       
    52 
       
    53     delete themeInfo;
       
    54     
       
    55     pair = themes.at(1);
       
    56     name = pair.first;
       
    57     themePath = pair.second;
       
    58     themeInfo = CpThemeUtil::buildThemeInfo(themePath, name);
       
    59     
       
    60     obj->setThemeInfo(*themeInfo);
       
    61     
       
    62     QCOMPARE(obj->themeName(), name);
       
    63     QCOMPARE(obj->themeIcon(), themeInfo->icon());
       
    64         
       
    65 
       
    66     delete obj;
       
    67 
       
    68 }
       
    69 
       
    70 QTEST_MAIN(TestCpThemePreview)
       
    71 #include "unittest_cpthemepreview.moc"
       
    72