logsui/logsapp/tsrc/ut_logsapp/src/ut_logsappsettings.cpp
changeset 20 6a40edd41841
equal deleted inserted replaced
19:e4c884866116 20:6a40edd41841
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 //USER
       
    19 #include "ut_logsappsettings.h"
       
    20 #include "logsappsettings.h"
       
    21 #include <xqsettingsmanager.h>
       
    22 
       
    23 //SYSTEM
       
    24 #include <QtTest/QtTest>
       
    25 
       
    26 void UT_LogsAppSettings::initTestCase()
       
    27 {
       
    28 
       
    29 }
       
    30 
       
    31 void UT_LogsAppSettings::cleanupTestCase()
       
    32 {
       
    33 
       
    34 }
       
    35 
       
    36 
       
    37 void UT_LogsAppSettings::init()
       
    38 {
       
    39     int argc = 0;
       
    40     char* argv = 0;
       
    41     mSettings = new LogsAppSettings(argc, &argv);
       
    42 }
       
    43 
       
    44 void UT_LogsAppSettings::cleanup()
       
    45 {
       
    46     delete mSettings;
       
    47     mSettings = 0;
       
    48 }
       
    49 
       
    50 void UT_LogsAppSettings::testLogsFeaturePreloadingEnabled()
       
    51 {
       
    52     QVERIFY( !mSettings->logsFeaturePreloadingEnabled() );
       
    53     delete mSettings;
       
    54     mSettings = 0;
       
    55     int argc = 2;
       
    56     char* argv[] = {"-logsbootup", "B"};
       
    57     mSettings = new LogsAppSettings(argc, argv);
       
    58     QVERIFY( mSettings->logsFeaturePreloadingEnabled() );
       
    59 }
       
    60 
       
    61 void UT_LogsAppSettings::testLogsFeatureFakeExitEnabled()
       
    62 {
       
    63     QVERIFY( mSettings->mFeatureFakeExitEnabledVal == -1 );
       
    64     
       
    65     // No such key
       
    66     XQSettingsManager::mFailed = true;
       
    67     QVERIFY( !mSettings->logsFeatureFakeExitEnabled() );
       
    68     
       
    69     // Verify that key is read only once
       
    70     XQSettingsManager::mFailed = false;
       
    71     XQSettingsManager::mCurrentVal = 1;
       
    72     QVERIFY( !mSettings->logsFeatureFakeExitEnabled() );
       
    73     
       
    74     // First read when key is there and value means enabled
       
    75     mSettings->mFeatureFakeExitEnabledVal = -1;
       
    76     QVERIFY( mSettings->logsFeatureFakeExitEnabled() );
       
    77     
       
    78     // Value means disabled
       
    79     XQSettingsManager::mCurrentVal = 0;
       
    80     mSettings->mFeatureFakeExitEnabledVal = -1;
       
    81     QVERIFY( !mSettings->logsFeatureFakeExitEnabled() );
       
    82 }
       
    83 
       
    84