videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/inc/testvideosortfilterproxymodel.h
changeset 62 0e1e938beb1a
parent 59 a76e86df7ccd
child 65 a9d57bd8d7b7
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
     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:   tester for methods in VideoSortFilterProxyModel
       
    15 * 
       
    16 */
       
    17 
       
    18 #ifndef __TESTVIDEOSORTFILTERPROXYMODEL_H__
       
    19 #define __TESTVIDEOSORTFILTERPROXYMODEL_H__
       
    20 
       
    21 
       
    22 // INCLUDES
       
    23 #include <QtTest/QtTest>
       
    24 #include <mpxitemid.h>
       
    25 
       
    26 class VideoListDataModel;
       
    27 class FilterProxyTester;
       
    28 class VideoCollectionClient;
       
    29 class VideoSortFilterProxyModel;
       
    30 
       
    31 class TestVideoSortFilterProxyModel : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35     // test functions for the test framework
       
    36     
       
    37 signals:
       
    38     
       
    39     /**
       
    40      * test signal
       
    41      */
       
    42     void testSignal();
       
    43 
       
    44     /**
       
    45      * test signal
       
    46      */
       
    47     void testSignalMpxId(const TMPXItemId &id);
       
    48     
       
    49 private slots:
       
    50 
       
    51     /**
       
    52      * will be called before each testfunction is executed.
       
    53      *
       
    54      */
       
    55     void init(); 
       
    56     
       
    57     /**
       
    58      * will be called after every testfunction.
       
    59      *
       
    60      */
       
    61     void cleanup();
       
    62 
       
    63     /**
       
    64      * Test initialize with valid data.
       
    65      */
       
    66     void testInitialize();
       
    67     
       
    68     /**
       
    69      * Test initialize with null model causing connect to fail.
       
    70      */
       
    71     void testInitializeSignalConnectFail();
       
    72         
       
    73     /**
       
    74      * Test second call to initialize with valid data.
       
    75      */
       
    76     void testSecondInitialize();
       
    77     
       
    78     /**
       
    79      * Test open.
       
    80      */
       
    81     void testOpen();
       
    82     
       
    83     /**
       
    84      * Test deleteItems with valid data.
       
    85      */
       
    86     void testDeleteItems();
       
    87     
       
    88     /**
       
    89      * Test deleteItems with NULL model.
       
    90      */
       
    91     void testDeleteItemsModelNull();    
       
    92     
       
    93     /**
       
    94      * Test deleteItems when removeRows fails.
       
    95      */
       
    96     void testDeleteItemsRemoveRowsFail();
       
    97 
       
    98     /**
       
    99      * Test openItem when getMediaId fails.
       
   100      */
       
   101     void testOpenItemInvalidId();    
       
   102 
       
   103     /**
       
   104      * Test openItem when collection is NULL.
       
   105      */
       
   106     void testOpenItemCollectionNull();
       
   107     
       
   108     /**
       
   109      * Test openItem when openVideo fails.
       
   110      */
       
   111     void testOpenItemOpenVideoFails();
       
   112     
       
   113     /**
       
   114     * Test openItem with valid data.
       
   115     */
       
   116     void testOpenItem();
       
   117 
       
   118     /**
       
   119      * Test back with valid data.
       
   120      */
       
   121     void testBack();
       
   122 
       
   123     /**
       
   124      * Test fetchItemDetails with valid data.
       
   125      */
       
   126     void testFetchItemDetails();
       
   127 
       
   128     /**
       
   129      * Test fetchItemDetails when getMediaId fails.
       
   130      */
       
   131     void testFetchItemDetailsGetMediaIdFail();    
       
   132 
       
   133     /**
       
   134      * Test fetchItemDetails when getVideoDetails fails.
       
   135      */
       
   136     void testFetchItemDetailsGetVideoDetailsFails();
       
   137 
       
   138     /**
       
   139      * Test lessThan when there's no mModel.
       
   140      */
       
   141     void testLessThanNoModel();
       
   142     
       
   143     /**
       
   144      * Calls sure lessThan with Qt::DisplayRole setted on 
       
   145      * tests that return values are correct for presetted items
       
   146      */
       
   147     void testLessThanName();
       
   148     
       
   149     /**
       
   150      * Calls sure lessThan with VideoCollectionCommon::KeySizeValue setted on 
       
   151      * tests that return values are correct for presetted items
       
   152      */
       
   153     void testLessThanSize();
       
   154     
       
   155     /**
       
   156      * Calls sure lessThan with VideoCollectionCommon::KeyDate setted on 
       
   157      * tests that return values are correct for presetted items
       
   158      */
       
   159     void testLessThanDateTime();
       
   160     
       
   161     /**
       
   162      * Calls less than with media objects of combined default / user created 
       
   163      * collections
       
   164      */
       
   165     void testLessThanDefaults();
       
   166     
       
   167     /**
       
   168      * Calls sure lessThan with invalid role,
       
   169      * same indexes and for invalid data
       
   170      * tests that return values are correct for presetted items
       
   171      */
       
   172     void testLessThanInvalid();
       
   173     
       
   174     /**
       
   175      * Calls doSorting.
       
   176      * tests that sorting is done only once
       
   177      */
       
   178     void testDoSorting();
       
   179     
       
   180     /**
       
   181      * Calls filterAcceptsRow. using type EAllVideos for model
       
   182      * Tests that return values are correct with items with varying statuses.
       
   183      * 
       
   184      */
       
   185     void testFilterAcceptsRowVideos();
       
   186     
       
   187     /**
       
   188      * Calls filterAcceptsRow. using type differ than EAllVideos for model
       
   189      * Tests that return values are correct with items with varying statuses.
       
   190      * 
       
   191      */
       
   192     void testFilterAcceptsNoVideoTypes();
       
   193 
       
   194     /**
       
   195      * Test getMediaFilePathForId.
       
   196      */
       
   197     void testGetMediaFilePathForId();
       
   198  
       
   199     /**
       
   200      * Tests calling addNewCollection when initialize has not been called.
       
   201      */
       
   202     void testAddNewCollectionNoCollectionClient();
       
   203     
       
   204     /**
       
   205      * Tests calling addNewCollection where collection client returns 0.
       
   206      */
       
   207     void testAddNewCollectionSucceed();
       
   208     
       
   209     /**
       
   210      * tests resolveAlbumName
       
   211      */
       
   212     void testResolveAlbumName();
       
   213     
       
   214     /**
       
   215      * tests addItemsInAlbum
       
   216      */
       
   217     void testAddItemsInAlbum();
       
   218     
       
   219     /**
       
   220      * tests removeItemsFromAlbum
       
   221      */
       
   222     void testRemoveItemsFromAlbum();
       
   223     
       
   224     /**
       
   225      * tests getOpenItem
       
   226      */
       
   227     void testGetOpenItem();
       
   228     
       
   229     /**
       
   230      * tests removeAlbums
       
   231      */
       
   232     void testRemoveAlbums();
       
   233     
       
   234     /**
       
   235      * tests albumChangedSlot
       
   236      */
       
   237     void testAlbumChangedSlot();
       
   238     
       
   239     /**
       
   240      * tests indexOfId
       
   241      */
       
   242     void testIndexOfId();
       
   243     
       
   244     /**
       
   245      * tests setGenericIdFilter
       
   246      */
       
   247     void testSetGenericIdFilter();
       
   248     
       
   249     /**
       
   250      * tests setAlbumInUse
       
   251      */
       
   252     void testSetAlbumInUse();
       
   253     
       
   254     /**
       
   255      * tests renameItem
       
   256      */
       
   257     void testRenameItem();
       
   258     
       
   259 
       
   260 private:
       
   261     
       
   262     /**
       
   263      * stub videolist model
       
   264      */
       
   265 	VideoListDataModel   *mStubModel;
       
   266 
       
   267     /**
       
   268      * stub CVideoCollectionClient.
       
   269      */
       
   270     VideoCollectionClient *mCollectionClient;
       
   271     
       
   272     /**
       
   273      * tester object inherited from the actual test object
       
   274      * implemented to be able to call protected objects
       
   275      */
       
   276     FilterProxyTester *mTestObject;
       
   277     
       
   278     /**
       
   279      * dummy collections content proxy
       
   280      */
       
   281     VideoSortFilterProxyModel *mCollectionModel;
       
   282 };
       
   283 
       
   284 
       
   285 #endif  // __TESTVIDEOSORTFILTERPROXYMODEL_H__
       
   286 
       
   287 // End of file
       
   288     
       
   289 
       
   290