homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsviewappdetailsstate.cpp
changeset 90 3ac3aaebaee5
child 97 66b5fe3c07fd
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:  Main test class for hsHomeScreenStatePlugin library.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QStateMachine>
       
    19 #include <QSet>
       
    20 #include <HbDialog>
       
    21 #include <HbLabel>
       
    22 #include <HbScrollArea>
       
    23 #include "hsmenuworkerstate.h"
       
    24 #include "hsviewappdetailsstate.h"
       
    25 #include <casoftwareregistry.h>
       
    26 #include "t_hsmenuworkerstateplugin.h"
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 void MenuStatesTest::ViewAppDetails_construction()
       
    32 {
       
    33 #ifdef Q_OS_SYMBIAN
       
    34 #ifdef UT_MEMORY_CHECK
       
    35     __UHEAP_MARK;
       
    36 #endif//UT_MEMORY_CHECK
       
    37 #endif//Q_OS_SYMBIAN
       
    38     {
       
    39         HsMenuWorkerState parentState1;
       
    40 
       
    41         HsViewAppDetailsState vas1(&parentState1);
       
    42         QString s1 = vas1.objectName();
       
    43         QVERIFY(s1 == tr("homescreen.nokia.com/state/MenuWorkerState/ViewAppDetailsState"));
       
    44 
       
    45     }
       
    46 #ifdef Q_OS_SYMBIAN
       
    47 #ifdef UT_MEMORY_CHECK
       
    48     __UHEAP_MARKEND;
       
    49 #endif//UT_MEMORY_CHECK
       
    50 #endif//Q_OS_SYMBIAN
       
    51 }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 void MenuStatesTest::ViewAppDetails_onEntry()
       
    57 {
       
    58 #ifdef Q_OS_SYMBIAN
       
    59 #ifdef UT_MEMORY_CHECK
       
    60     __UHEAP_MARK;
       
    61 #endif//UT_MEMORY_CHECK
       
    62 #endif//Q_OS_SYMBIAN
       
    63     {
       
    64         HsMenuWorkerState parentState1;
       
    65         HsViewAppDetailsState viewAppDetailsState(&parentState1);
       
    66 
       
    67         QString testNewName(QString("TestNewName") +
       
    68                             QDateTime::currentDateTime().toString("ddmmyyyy_hh_mm_ss_zzz"));
       
    69 
       
    70         CaQuery query;
       
    71         query.setFlagsOn(RemovableEntryFlag);
       
    72         QStringList typeNames;
       
    73         typeNames.append(Hs::applicationTypeName);
       
    74         query.setEntryTypeNames(typeNames);
       
    75         QList< QSharedPointer<CaEntry> > entries = CaService::instance()->getEntries(query);
       
    76 
       
    77         int entryId = entries.size() < 1 ? 555 : entries[0]->id();
       
    78 
       
    79         QVariantMap eventAttributes;
       
    80         eventAttributes.insert(Hs::itemIdKey, entryId);
       
    81         QScopedPointer<HsMenuEvent> viewAppDetailsEvent;
       
    82         viewAppDetailsEvent.reset(new HsMenuEvent(
       
    83                 HsMenuEvent::ShowAppDetails, eventAttributes));
       
    84 
       
    85 
       
    86         viewAppDetailsState.onEntry(viewAppDetailsEvent.data());
       
    87 
       
    88         if (entries.size() < 1) {
       
    89             QWARN("No removable application or widget present.");
       
    90             return;
       
    91         }
       
    92 
       
    93         checkDialogController();
       
    94     }
       
    95 #ifdef Q_OS_SYMBIAN
       
    96 #ifdef UT_MEMORY_CHECK
       
    97     __UHEAP_MARKEND;
       
    98 #endif//UT_MEMORY_CHECK
       
    99 #endif//Q_OS_SYMBIAN
       
   100 }
       
   101 
       
   102 
       
   103