contentstorage/caclient/tsrc/t_caclient/inc/t_caclient.h
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     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:  Main test class for hspluginmodel library.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef T_CACLIENT_H
       
    19 #define T_CACLIENT_H
       
    20 
       
    21 #include <QtTest/QtTest>
       
    22 #include "cadefs.h"
       
    23 
       
    24 #ifdef Q_OS_SYMBIAN
       
    25 #include <e32std.h>
       
    26 #endif
       
    27 
       
    28 class CaService;
       
    29 class CaEntry;
       
    30 class CaItemModel;
       
    31 
       
    32 /**
       
    33  * @test Test class for hsmcsserviceprovider library.
       
    34  */
       
    35 class TestCaClient : public QObject
       
    36 {
       
    37     Q_OBJECT
       
    38 
       
    39 private slots:
       
    40 
       
    41 #ifdef Q_OS_SYMBIAN
       
    42     //executeCommand
       
    43     void TestExecuteCommandRemove();
       
    44     
       
    45     void TestExecuteCommandOpen();
       
    46 #endif //Q_OS_SYMBIAN
       
    47 
       
    48     /**
       
    49      * initialize
       
    50      */
       
    51     void initTestCase();
       
    52 
       
    53     //localization
       
    54 
       
    55     void TestLocalizationEntryGetters();
       
    56     
       
    57     void TestLocalizationTApp();
       
    58 
       
    59     void TestCreateLocalizedItem();
       
    60 
       
    61 // query&entry getters
       
    62     void TestEntryGetters();
       
    63 
       
    64     void TestEntryAssignmentOperator();
       
    65 
       
    66     void TestQueryGetters();
       
    67 
       
    68     void TestQueryClear();
       
    69 
       
    70     void TestQueryRemove();
       
    71 
       
    72     void TestQueryAssignmentOperator();
       
    73 
       
    74     void TestMakeDefaultCollectionIcon();
       
    75 
       
    76     void TestMakeDefaultApplicationIcon();
       
    77 
       
    78     void TestMakeNotNativeApplicationIcon();
       
    79 
       
    80     void TestMakeExistingIcon();
       
    81 
       
    82     void TestMakeNotExistingIcon();
       
    83     
       
    84     void TestGetEntryIcon();
       
    85     void TestGetApplicationIcon();
       
    86     void TestGetIconFromEntry();
       
    87     void TestGetIconFromApparc();
       
    88     void TestGetDefaultIcon();
       
    89 
       
    90 
       
    91 //create&update
       
    92     void TestUpdateItem();
       
    93 
       
    94     void TestCreateItem();
       
    95     
       
    96     void TestCreateGroup();
       
    97 
       
    98     void TestCreateItemNotAllParams();
       
    99 
       
   100     void TestCreateGroupNotAllParams();
       
   101 
       
   102     void TestUpdateGroup();
       
   103     
       
   104 //remove
       
   105     void TestRemoveItem();
       
   106 
       
   107     void TestRemoveGroup();
       
   108 
       
   109     void TestRemoveItems();
       
   110 
       
   111     void TestRemoveItemsFail();
       
   112 
       
   113     void TestRemoveGroups();
       
   114 
       
   115     void TestRemoveGroupsFail();
       
   116 
       
   117 // backup
       
   118     
       
   119     void TestCreateBackupNotifier();
       
   120     
       
   121     void TestBackupNotifierRunL();
       
   122 
       
   123 
       
   124 //organize
       
   125 
       
   126     void TestAppendEntryIntoGroup1();
       
   127 
       
   128     void TestAppendEntryIntoGroup2();
       
   129 
       
   130     void TestAppendEntriesIntoGroup1();
       
   131 
       
   132     void TestAppendEntriesIntoGroup2();
       
   133 
       
   134     void TestPrependEntryIntoGroup1();
       
   135 
       
   136     void TestPrependEntryIntoGroup2();
       
   137 
       
   138     void TestPrependEntriesIntoGroup1();
       
   139 
       
   140     void TestPrependEntriesIntoGroup2();
       
   141 
       
   142     void TestInsertEntryIntoGroup1();
       
   143 
       
   144     void TestInsertEntryIntoGroup2();
       
   145 
       
   146     void TestInsertEntriesIntoGroup1();
       
   147 
       
   148     void TestInsertEntriesIntoGroup2();
       
   149 
       
   150     void TestRemoveEntryFromGroup1();
       
   151 
       
   152     void TestRemoveEntryFromGroup2();
       
   153 
       
   154     void TestRemoveEntriesFromGroup1();
       
   155 
       
   156     void TestRemoveEntriesFromGroup2();
       
   157 
       
   158     void TestCustomSort();
       
   159 
       
   160     void TestCustomSortArrange();
       
   161 
       
   162     void TestCustomSortGroups();
       
   163 
       
   164     void TestCustomSortFake();
       
   165 
       
   166 
       
   167 //get entries
       
   168     void TestGetEntry();
       
   169 
       
   170     void TestGetEntriesByIds();
       
   171 
       
   172     void TestGetEntriesByRole();
       
   173 
       
   174     void TestGetEntriesByParent();
       
   175 
       
   176     void TestGetEntriesByType1();
       
   177 
       
   178     void TestGetEntriesByType2();
       
   179 
       
   180     void TestGetEntriesByFlagsOn();
       
   181 
       
   182     void TestGetEntriesByFlagsOff();
       
   183 
       
   184     void TestGetEntriesByFlagsOnOff();
       
   185 
       
   186     void TestGetEntriesByRoleParent();
       
   187 
       
   188     void TestGetEntriesByRoleType();
       
   189 
       
   190     void TestGetEntriesByRoleFlags();
       
   191 
       
   192     void TestGetEntriesByParentType();
       
   193 
       
   194     void TestGetEntriesByParentFlags();
       
   195 
       
   196     void TestGetEntriesByTypeFlags();
       
   197 
       
   198     void TestGetEntriesByRoleParentType();
       
   199 
       
   200     void TestGetEntriesByRoleParentFlags();
       
   201 
       
   202     void TestGetEntriesByParentTypeFlags();
       
   203 
       
   204     void TestGetEntriesByRoleParentTypeFlags();
       
   205 
       
   206     void TestGetEntriesCount();
       
   207 
       
   208     void TestGetEntriesSortCreated();
       
   209 
       
   210     void TestGetEntriesSortDefault();
       
   211 
       
   212     void TestGetEntriesSortName();
       
   213 
       
   214     void TestGetEntriesSortLast();
       
   215 
       
   216     void TestGetEntriesSortMost();
       
   217 
       
   218     void TestGetEntriesIdsByRole();
       
   219 
       
   220     void TestGetEntriesIdsByParent();
       
   221 
       
   222     void TestGetEntriesIdsByType1();
       
   223 
       
   224     void TestGetEntriesIdsByType2();
       
   225 
       
   226     void TestGetEntriesIdsByFlagsOn();
       
   227 
       
   228     void TestGetEntriesIdsByFlagsOff();
       
   229 
       
   230     void TestGetEntriesIdsByFlagsOnOff();
       
   231 
       
   232     void TestGetEntriesIdsByRoleParent();
       
   233 
       
   234     void TestGetEntriesIdsByRoleType();
       
   235 
       
   236     void TestGetEntriesIdsByRoleFlags();
       
   237 
       
   238     void TestGetEntriesIdsByParentType();
       
   239 
       
   240     void TestGetEntriesIdsByParentFlags();
       
   241 
       
   242     void TestGetEntriesIdsByTypeFlags();
       
   243 
       
   244     void TestGetEntriesIdsByRoleParentType();
       
   245 
       
   246     void TestGetEntriesIdsByRoleParentFlags();
       
   247 
       
   248     void TestGetEntriesIdsByParentTypeFlags();
       
   249 
       
   250     void TestGetEntriesIdsByRoleParentTypeFlags();
       
   251 
       
   252     void TestGetEntriesIdsCount();
       
   253 
       
   254     void TestGetEntriesIdsSortDefault();
       
   255 
       
   256     void TestGetEntriesIdsSortCreated();
       
   257 
       
   258     void TestGetEntriesIdsSortName();
       
   259 
       
   260     void TestGetEntriesIdsSortLast();
       
   261 
       
   262     void TestGetEntriesIdsSortMost();
       
   263     
       
   264     void TestGetEntriesByAttributes();
       
   265 
       
   266     //caitemmodel
       
   267     void TestCaItemModelConstruct();
       
   268     void TestCaItemModelAutoUpdate();
       
   269     void TestCaItemModelIndex();
       
   270     void TestCaItemModelData();
       
   271     void TestCaItemModelIconSize();
       
   272     void TestCaItemModelChangeParent();
       
   273     void TestCaItemModelSortOrder();
       
   274     void TestCaItemModelUpdateItem();
       
   275     void TestCaItemModelAddItems();
       
   276     void TestCaItemModelEmptySignal();
       
   277 
       
   278 // notifier
       
   279 
       
   280     void TestAssignmentOperatorNotifier();
       
   281 
       
   282     void TestAddItemChangeTypeNotifier();
       
   283     void TestAddGroupChangeTypeNotifier();
       
   284 
       
   285     void TestRemoveEntryChangeTypeNotifier();
       
   286     void TestRemoveEntryIdChangeTypeNotifier();
       
   287     void TestRemoveEntryChangeTypeNotifierFake();
       
   288     void TestRemoveEntryIdChangeTypeNotifierFake();
       
   289     void TestRemoveEntriesChangeTypeNotifier();
       
   290     void TestRemoveEntriesIdsChangeTypeNotifier();
       
   291     void TestRemoveEntriesChangeTypeNotifierFake();
       
   292     void TestRemoveEntriesIdsChangeTypeNotifierFake();
       
   293     void TestRemoveGroupChangeTypeNotifier();
       
   294     void TestRemoveGroupsChangeTypeNotifier();
       
   295 
       
   296     void TestUpdateChangeTypeNotifier();
       
   297     void TestUpdateChangeTypeNotifierFake();
       
   298     void TestAddUpdateRemove();
       
   299 
       
   300     void TestRegisterNotifier();
       
   301     void TestUnregisterNotifier();
       
   302 
       
   303     void TestTouchEntryNotifier();
       
   304     void TestTouchEntryIdNotifier();
       
   305     void TestTouchEntryUidNotifier();
       
   306     void TestTouchEntryNotifierFake();
       
   307     void TestTouchEntryIdNotifierFake();
       
   308     void TestTouchGroupNotifier();
       
   309 
       
   310     void TestAppendEntryGroupNotifier();
       
   311     void TestAppendEntryGroupIdNotifier();
       
   312     void TestAppendEntriesGroupNotifier();
       
   313     void TestAppendEntriesGroupIdNotifier();
       
   314 
       
   315     void TestPrependEntryGroupNotifier();
       
   316     void TestPrependEntryGroupIdNotifier();
       
   317     void TestPrependEntriesGroupNotifier();
       
   318     void TestPrependEntriesGroupIdNotifier();
       
   319 
       
   320     void TestRemoveEntryGroupNotifier();
       
   321     void TestRemoveEntryGroupIdNotifier();
       
   322     void TestRemoveEntriesGroupNotifier();
       
   323     void TestRemoveEntriesGroupIdNotifier();
       
   324 
       
   325     void TestInsertEntryGroupNotifier();
       
   326     void TestInsertEntryGroupIdNotifier();
       
   327     void TestInsertEntriesGroupNotifier();
       
   328     void TestInsertEntriesGroupIdNotifier();
       
   329 
       
   330     void TestChangeEntryWithParentIdNotifier();
       
   331 
       
   332     
       
   333    
       
   334     void TestRemoveEntriesChangeTypeNotifier3Clients();
       
   335 
       
   336     void TestAddItemChangeTypeNotifierNClients();
       
   337     void TestAddItemChangeTypeNotifierNClientsFast();
       
   338     void TestAddItemChangeTypeNotifierNClientsThreads();
       
   339 
       
   340     void TestRemoveEntryChangeTypeNotifierNClients();
       
   341     void TestRemoveEntryChangeTypeNotifierNClientsThreads();
       
   342     void TestRemoveEntryIdChangeTypeNotifierNClientsThreads();
       
   343 
       
   344     void TestAddItemChangeTypeNotifierManyClientsThreads();
       
   345     //void TestRemoveEntriesChangeTypeNotifier3Clients();
       
   346 
       
   347     // void TestAppendRemoveEntryGroupNotifier();
       
   348 
       
   349     void TestCreateItemWhenServerWasTerminated();
       
   350     
       
   351     void TestAddItemChangeTypeNotifier3Clients();
       
   352     void TestRemoveEntryChangeTypeNotifier3Clients();
       
   353     
       
   354     /**
       
   355      * cleanup
       
   356      */
       
   357     void cleanupTestCase();
       
   358 
       
   359 private:
       
   360     void startThread();
       
   361     void stopThread();
       
   362     // utility methods
       
   363     QSharedPointer<CaEntry>  createGroup(const QString &groupName, const QString &typeName);
       
   364     QSharedPointer<CaEntry> createItem(const QString &itemName, const QString &description,
       
   365                         const QString &typeName, EntryFlags flags);
       
   366     QSharedPointer<CaEntry> createItem(const QString &itemName, const QString &typeName);
       
   367     void addItemToGroup(int groupId, int itemId);
       
   368     void removeItemFromGroup(int groupId, int itemId);
       
   369     void removeEntry(int entryId);
       
   370     bool removeEntry(const QString &entryName);
       
   371     QString itemName(const CaItemModel &model, int row);
       
   372     void terminatServer();
       
   373 
       
   374 #ifdef Q_OS_SYMBIAN
       
   375     RThread iThread;
       
   376 #endif //Q_OS_SYMBIAN
       
   377 
       
   378 private:
       
   379     QSharedPointer<CaService> mService;
       
   380 };
       
   381 
       
   382 
       
   383 #endif//T_CACLIENT_H