homescreenapp/hsdomainmodel/tsrc/t_hsdomainmodel/src/t_hsgui.cpp
changeset 96 458d8c8d9580
equal deleted inserted replaced
92:6727c5d0afc7 96:458d8c8d9580
       
     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 "t_hsdomainmodel.h"
       
    19 #include "hsgui.h"
       
    20 
       
    21 
       
    22 void TestHsDomainModel::testGuiStaticInterface()
       
    23 {    
       
    24     HsGui *stored = HsGui::takeInstance();
       
    25     
       
    26     HsGui *gui = new HsGui;    
       
    27     HsGui::setInstance(gui);
       
    28     HsGui::setInstance(gui);
       
    29     QVERIFY(HsGui::instance() == gui);    
       
    30     HsGui *gui2 = HsGui::takeInstance();    
       
    31     QVERIFY(gui == gui2);
       
    32     delete gui;
       
    33     
       
    34     HsGui::setInstance(stored);
       
    35 }
       
    36 
       
    37 void TestHsDomainModel::testSetupCleanupIdleUi()
       
    38 {
       
    39     HsGui *gui = HsGui::instance();    
       
    40 
       
    41     gui->setupIdleUi();
       
    42     QVERIFY(gui->idleWidget());
       
    43     QVERIFY(gui->idleView());    
       
    44     gui->setupIdleUi();
       
    45 
       
    46     gui->cleanupIdleUi();    
       
    47     QVERIFY(!gui->idleView());
       
    48 }
       
    49 
       
    50 
       
    51 void TestHsDomainModel::testOrientation()
       
    52 {
       
    53     HsGui *gui = HsGui::instance();
       
    54     Qt::Orientation orientation = gui->orientation();
       
    55     
       
    56     if (orientation == Qt::Horizontal){
       
    57         gui->setOrientation(Qt::Vertical);
       
    58     }
       
    59     else {
       
    60         gui->setOrientation(Qt::Horizontal);
       
    61     }        
       
    62     QVERIFY(gui->orientation() != orientation);
       
    63     
       
    64     gui->setOrientation(orientation);
       
    65     QVERIFY(gui->orientation() == orientation);
       
    66 }
       
    67 
       
    68 
       
    69 void TestHsDomainModel::testShow()
       
    70 {
       
    71     HsGui *gui = HsGui::instance();
       
    72     gui->setupIdleUi();
       
    73     gui->show();
       
    74     gui->cleanupIdleUi();    
       
    75 }
       
    76 
       
    77 void TestHsDomainModel::testPageChangeAnimation()
       
    78 {
       
    79     HsGui *gui = HsGui::instance();
       
    80     
       
    81     QVERIFY(gui->pageChangeAnimation());
       
    82     gui->cleanupIdleUi();    
       
    83 }
       
    84 
       
    85 void TestHsDomainModel::testPageCrawlingAnimation()
       
    86 {
       
    87     HsGui *gui = HsGui::instance();
       
    88     
       
    89     QVERIFY(gui->pageCrawlingAnimation());
       
    90     gui->cleanupIdleUi();    
       
    91 }