messagingapp/msgui/unifiededitor/tsrc/unittest_msgunieditorutils/src/unittest_msgunieditorutils.cpp
changeset 76 60a8a215b0ec
equal deleted inserted replaced
73:ecf6a73a9186 76:60a8a215b0ec
       
     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 MsgUnifiedEditorPixmapWidget
       
    15 *
       
    16 */
       
    17 
       
    18 #include "unittest_msgunieditorutils.h"    
       
    19 #include <QtTest/QTest>
       
    20 #include <QtTest/QSignalSpy>
       
    21 #include "msguitest.h"
       
    22 const QString IMAGE_JPEG_CIF_PATH = "c:\\data\\testUniEditor\\JPEG_CIF.JPG";
       
    23 const QString IMAGE_MIMETYPE("image");
       
    24 TestMsgUnifiedEditorUtils::TestMsgUnifiedEditorUtils()
       
    25     {
       
    26     
       
    27     }
       
    28 TestMsgUnifiedEditorUtils::~TestMsgUnifiedEditorUtils()
       
    29     {
       
    30     
       
    31     }
       
    32 void TestMsgUnifiedEditorUtils::initTestCase()
       
    33     {
       
    34         mMsgUnifiedEditorUtils = new MsgUnifiedEditorUtils();
       
    35         QVERIFY(mMsgUnifiedEditorUtils != NULL);
       
    36     }
       
    37            
       
    38 void TestMsgUnifiedEditorUtils::test_Constructor()
       
    39     {
       
    40     /*nothing to check*/
       
    41     }
       
    42 
       
    43 
       
    44 void TestMsgUnifiedEditorUtils::test_handleOk()
       
    45     {
       
    46         QSignalSpy signaleHandlerOK(mMsgUnifiedEditorUtils, SIGNAL(requestOk(const QVariant&)));
       
    47         QVariant lVariant;
       
    48         lVariant.setValue(QString("OK"));
       
    49 
       
    50         QCOMPARE( signaleHandlerOK.count(), 0 );
       
    51         mMsgUnifiedEditorUtils->handleOk(lVariant);
       
    52         QCOMPARE( signaleHandlerOK.count(), 1 );
       
    53     }
       
    54 
       
    55 void TestMsgUnifiedEditorUtils::test_handleError()
       
    56     {
       
    57         QSignalSpy signaleHandlerError(mMsgUnifiedEditorUtils, SIGNAL(requestError(int, const QString&)));
       
    58         QString lString = "Not found";
       
    59         int errorcode = KErrNotFound;
       
    60         QCOMPARE( signaleHandlerError.count(), 0 );
       
    61         mMsgUnifiedEditorUtils->handleError(errorcode, lString);
       
    62         QCOMPARE( signaleHandlerError.count(), 1 );
       
    63     }
       
    64 
       
    65 void TestMsgUnifiedEditorUtils::test_launchContentViewer()
       
    66     {
       
    67     mMsgUnifiedEditorUtils->launchContentViewer(IMAGE_MIMETYPE,IMAGE_JPEG_CIF_PATH);
       
    68     }
       
    69 
       
    70 void TestMsgUnifiedEditorUtils::cleanupTestCase()
       
    71     {
       
    72         delete mMsgUnifiedEditorUtils;
       
    73     }
       
    74 
       
    75 //entry point.
       
    76 MSGUI_TEST_MAIN(TestMsgUnifiedEditorUtils)