videocollection/videocollectionwrapper/tsrc/testvideoproxymodelgeneric/inc/testvideoproxymodelgeneric.h
changeset 62 0e1e938beb1a
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 VideoProxyModelGeneric
       
    15 * 
       
    16 */
       
    17 
       
    18 #ifndef __TESTVIDEOPROXYMODELGENERIC_H__
       
    19 #define __TESTVIDEOPROXYMODELGENERIC_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 VideoProxyModelGeneric;
       
    30 
       
    31 class TestVideoProxyModelGeneric : 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      * Tests initialize.
       
    65      */
       
    66     void testInitialize();
       
    67     
       
    68     /**
       
    69      * Test open.
       
    70      */
       
    71     void testOpen();
       
    72     
       
    73     /**
       
    74      * Test deleteItems with valid data.
       
    75      */
       
    76     void testDeleteItems();
       
    77     
       
    78     /**
       
    79      * Test deleteItems with NULL model.
       
    80      */
       
    81     void testDeleteItemsModelNull();    
       
    82     
       
    83     /**
       
    84      * Test deleteItems when removeRows fails.
       
    85      */
       
    86     void testDeleteItemsRemoveRowsFail();
       
    87 
       
    88     /**
       
    89      * Test openItem when getMediaId fails.
       
    90      */
       
    91     void testOpenItemInvalidId();    
       
    92 
       
    93     /**
       
    94      * Test openItem when collection is NULL.
       
    95      */
       
    96     void testOpenItemCollectionNull();
       
    97     
       
    98     /**
       
    99      * Test openItem when openVideo fails.
       
   100      */
       
   101     void testOpenItemOpenVideoFails();
       
   102     
       
   103     /**
       
   104     * Test openItem with valid data.
       
   105     */
       
   106     void testOpenItem();
       
   107 
       
   108     /**
       
   109      * Test back with valid data.
       
   110      */
       
   111     void testBack();
       
   112 
       
   113     /**
       
   114      * Test fetchItemDetails with valid data.
       
   115      */
       
   116     void testFetchItemDetails();
       
   117 
       
   118     /**
       
   119      * Test fetchItemDetails when getMediaId fails.
       
   120      */
       
   121     void testFetchItemDetailsGetMediaIdFail();    
       
   122 
       
   123     /**
       
   124      * Test fetchItemDetails when getVideoDetails fails.
       
   125      */
       
   126     void testFetchItemDetailsGetVideoDetailsFails();
       
   127 
       
   128     /**
       
   129      * Test lessThan when there's no mModel.
       
   130      */
       
   131     void testLessThanNoModel();
       
   132     
       
   133     /**
       
   134      * Calls sure lessThan with Qt::DisplayRole setted on 
       
   135      * tests that return values are correct for presetted items
       
   136      */
       
   137     void testLessThanName();
       
   138     
       
   139     /**
       
   140      * Calls sure lessThan with VideoCollectionCommon::KeySizeValue setted on 
       
   141      * tests that return values are correct for presetted items
       
   142      */
       
   143     void testLessThanSize();
       
   144     
       
   145     /**
       
   146      * Calls sure lessThan with VideoCollectionCommon::KeyDate setted on 
       
   147      * tests that return values are correct for presetted items
       
   148      */
       
   149     void testLessThanDateTime();
       
   150     
       
   151     /**
       
   152      * Calls less than with media objects of combined default / user created 
       
   153      * collections
       
   154      */
       
   155     void testLessThanDefaults();
       
   156     
       
   157     /**
       
   158      * Calls sure lessThan with invalid role,
       
   159      * same indexes and for invalid data
       
   160      * tests that return values are correct for presetted items
       
   161      */
       
   162     void testLessThanInvalid();
       
   163     
       
   164     /**
       
   165      * Calls doSorting.
       
   166      * tests that sorting is done only once
       
   167      */
       
   168     void testDoSorting();
       
   169     
       
   170     /**
       
   171      * Calls filterAcceptsRow. using type EAllVideos for model
       
   172      * Tests that return values are correct with items with varying statuses.
       
   173      * 
       
   174      */
       
   175     void testFilterAcceptsRowVideos();
       
   176     
       
   177     /**
       
   178      * Calls filterAcceptsRow. using type differ than EAllVideos for model
       
   179      * Tests that return values are correct with items with varying statuses.
       
   180      * 
       
   181      */
       
   182     void testFilterAcceptsNoVideoTypes();
       
   183 
       
   184     /**
       
   185      * Test getMediaFilePathForId.
       
   186      */
       
   187     void testGetMediaFilePathForId();
       
   188  
       
   189     /**
       
   190      * Tests calling addNewCollection when initialize has not been called.
       
   191      */
       
   192     void testAddNewCollectionNoCollectionClient();
       
   193     
       
   194     /**
       
   195      * Tests calling addNewCollection where collection client returns 0.
       
   196      */
       
   197     void testAddNewCollectionSucceed();
       
   198     
       
   199     /**
       
   200      * tests resolveAlbumName
       
   201      */
       
   202     void testResolveAlbumName();
       
   203     
       
   204     /**
       
   205      * tests addItemsInAlbum
       
   206      */
       
   207     void testAddItemsInAlbum();
       
   208     
       
   209     /**
       
   210      * tests removeItemsFromAlbum
       
   211      */
       
   212     void testRemoveItemsFromAlbum();
       
   213     
       
   214     /**
       
   215      * tests getOpenItem
       
   216      */
       
   217     void testGetOpenItem();
       
   218     
       
   219     /**
       
   220      * tests removeAlbums
       
   221      */
       
   222     void testRemoveAlbums();
       
   223     
       
   224     /**
       
   225      * tests albumChangedSlot
       
   226      */
       
   227     //void testAlbumChangedSlot();
       
   228     
       
   229     /**
       
   230      * tests indexOfId
       
   231      */
       
   232     void testIndexOfId();
       
   233     
       
   234     /**
       
   235      * tests setGenericIdFilter
       
   236      */
       
   237     void testSetGenericIdFilter();
       
   238     
       
   239     /**
       
   240      * tests setAlbumInUse
       
   241      */
       
   242     void testSetAlbumInUse();
       
   243     
       
   244     /**
       
   245      * tests renameItem
       
   246      */
       
   247     void testRenameItem();
       
   248     
       
   249     /**
       
   250      * tests disconnectSignals
       
   251      */
       
   252     void testDisconnectSignals();
       
   253 
       
   254 private:
       
   255     
       
   256     /**
       
   257      * stub videolist model
       
   258      */
       
   259 	VideoListDataModel   *mStubModel;
       
   260 
       
   261     /**
       
   262      * stub CVideoCollectionClient.
       
   263      */
       
   264     VideoCollectionClient *mCollectionClient;
       
   265     
       
   266     /**
       
   267      * tester object inherited from the actual test object
       
   268      * implemented to be able to call protected objects
       
   269      */
       
   270     FilterProxyTester *mTestObject;
       
   271     
       
   272     /**
       
   273      * dummy collections content proxy
       
   274      */
       
   275     VideoProxyModelGeneric *mCollectionModel;
       
   276 };
       
   277 
       
   278 
       
   279 #endif  // __TESTVIDEOPROXYMODELGENERIC_H__
       
   280 
       
   281 // End of file
       
   282     
       
   283 
       
   284