organizer_plat/clock_settingsview_plugin_api/tsrc/unittest_clocksettingsviewplugin/src/unittest_clocksettingsviewplugin.cpp
changeset 45 b6db4fd4947b
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: Definition file for class TestClockSettingsViewPlugin.
       
    15 *
       
    16 */
       
    17 
       
    18 // System include
       
    19 #include <QtTest/QtTest>
       
    20 #include <ClockSettingsViewInterface>
       
    21 
       
    22 // User includes
       
    23 #include "unittest_clocksettingsviewplugin.h"
       
    24 
       
    25 
       
    26 /*!
       
    27 	\class TestClockSettingsViewPlugin
       
    28 
       
    29 	Unit test class for Clock settings view Plugin apis
       
    30  */
       
    31 
       
    32 
       
    33 /*!
       
    34 	Constructor
       
    35  */
       
    36 
       
    37 TestClockSettingsViewPlugin::TestClockSettingsViewPlugin()
       
    38 {
       
    39 }
       
    40 
       
    41 /*!
       
    42 	Destructor
       
    43  */
       
    44 TestClockSettingsViewPlugin::~TestClockSettingsViewPlugin()
       
    45 {
       
    46 }
       
    47 
       
    48 /*!
       
    49 	Initialise before calling the test case
       
    50  */
       
    51 void TestClockSettingsViewPlugin::init()
       
    52 {
       
    53 }
       
    54 
       
    55 /*!
       
    56 	Do cleanup after each test case
       
    57  */
       
    58 void TestClockSettingsViewPlugin::cleanup()
       
    59 {
       
    60 }
       
    61 
       
    62 /*!
       
    63 	Test the api of clock setting plugin
       
    64  */
       
    65 
       
    66 void TestClockSettingsViewPlugin::testPluginLoadUnLoad()
       
    67 {
       
    68 	QDir dir(CLOCK_SETTINGSVIEW_PLUGIN_PATH);
       
    69 	QString pluginName = dir.absoluteFilePath(CLOCK_SETTINGSVIEW_PLUGIN_NAME);
       
    70 	
       
    71 	// Create Clock setting view object
       
    72 	QPluginLoader *pluginLoader = new QPluginLoader(pluginName);
       
    73 	
       
    74 	// Load the plugin
       
    75 	QVERIFY(pluginLoader->load());
       
    76 
       
    77 	QObject *plugin = qobject_cast<QObject*> (pluginLoader->instance());
       
    78 
       
    79 	ClockSettingsViewInterface* interface =
       
    80 			qobject_cast<ClockSettingsViewInterface*>(plugin);
       
    81 
       
    82 	QVERIFY(interface);
       
    83 
       
    84 	// Unload the plugin
       
    85 	QVERIFY(pluginLoader->unload());
       
    86 	delete pluginLoader;
       
    87 }
       
    88 
       
    89 // End of file	--Don't remove this.