homescreenapp/hsutils/tsrc/t_hsutils/src/t_hsmenudialogfactory.cpp
changeset 90 3ac3aaebaee5
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
       
     1 /*
       
     2 * Copyright (c) 2010 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 *
       
    16 */
       
    17 
       
    18 #include <QString>
       
    19 #include <QScopedPointer>
       
    20 
       
    21 #include <HbGlobal>
       
    22 #include <HbAction>
       
    23 #include <HbMessageBox>
       
    24 #include "hsmenudialogfactory.h"
       
    25 #include "t_hsutils.h"
       
    26 
       
    27 
       
    28 #ifdef ONLY_MENU_TESTCASES
       
    29 
       
    30 void t_hsUtils::testMenuDialogFactoryCreate()
       
    31 {
       
    32     HsMenuDialogFactory hsMenuDialogFactory;
       
    33     const QString message("testMessage");
       
    34     QScopedPointer<HbMessageBox> box(
       
    35             hsMenuDialogFactory.create(message, HsMenuDialogFactory::OkCancel));
       
    36 
       
    37     QVERIFY(box);
       
    38     QCOMPARE(box->text(), message);
       
    39     QCOMPARE(box->actions().count(), 2);
       
    40     QCOMPARE(box->actions().at(HsMenuDialogFactory::acceptActionIndex())->text(),
       
    41              hbTrId("txt_common_button_ok"));
       
    42     QCOMPARE(box->actions().at(HsMenuDialogFactory::rejectActionIndex())->text(),
       
    43              hbTrId("txt_common_button_cancel"));
       
    44 
       
    45     box.reset(
       
    46             hsMenuDialogFactory.create(message, HsMenuDialogFactory::Close));
       
    47 
       
    48     QVERIFY(box);
       
    49     QCOMPARE(box->text(), message);
       
    50     QCOMPARE(box->actions().count(), 1);
       
    51     QCOMPARE(box->actions().at(HsMenuDialogFactory::acceptActionIndex())->text(),
       
    52              hbTrId("txt_common_button_close"));
       
    53 }
       
    54 #endif