windowing/windowserver/test/tauto/twindowsizecache.h
author hgs
Tue, 22 Jun 2010 15:21:29 +0300
changeset 103 2717213c588a
permissions -rw-r--r--
201024
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
103
hgs
parents:
diff changeset
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
//
hgs
parents:
diff changeset
    15
hgs
parents:
diff changeset
    16
/**
hgs
parents:
diff changeset
    17
 @file
hgs
parents:
diff changeset
    18
 @test
hgs
parents:
diff changeset
    19
 @internalComponent - Internal Symbian test code
hgs
parents:
diff changeset
    20
*/
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#ifndef __TWINDOWSIZECACHE_H__
hgs
parents:
diff changeset
    23
#define __TWINDOWSIZECACHE_H__
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include <e32std.h>
hgs
parents:
diff changeset
    26
#include <w32std.h>
hgs
parents:
diff changeset
    27
#include "AUTO.H"
hgs
parents:
diff changeset
    28
hgs
parents:
diff changeset
    29
#include "../nga/CLIENT/w32comm.h"
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
#include "../tlib/testbase.h"
hgs
parents:
diff changeset
    32
#include "TGraphicsHarness.h"
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
//-----------------------------------------------------------
hgs
parents:
diff changeset
    35
class CTWindowSizeCacheTest : public CTWsGraphicsBase
hgs
parents:
diff changeset
    36
    {
hgs
parents:
diff changeset
    37
public:
hgs
parents:
diff changeset
    38
    enum TSizeCacheStatus
hgs
parents:
diff changeset
    39
        {
hgs
parents:
diff changeset
    40
        ETestSizeCacheNotEnabled,
hgs
parents:
diff changeset
    41
        ETestSizeCacheEnabled,
hgs
parents:
diff changeset
    42
        };
hgs
parents:
diff changeset
    43
    enum TRWindowAction
hgs
parents:
diff changeset
    44
        {
hgs
parents:
diff changeset
    45
        ESetExtent,
hgs
parents:
diff changeset
    46
        ESetExtentErr,
hgs
parents:
diff changeset
    47
        ESetSize,
hgs
parents:
diff changeset
    48
        ESetSizeErr,
hgs
parents:
diff changeset
    49
        ECheckSize,
hgs
parents:
diff changeset
    50
        EFlushSession,
hgs
parents:
diff changeset
    51
        EEnableWindowSizeCache,
hgs
parents:
diff changeset
    52
        EMaxAction,
hgs
parents:
diff changeset
    53
        };
hgs
parents:
diff changeset
    54
public:
hgs
parents:
diff changeset
    55
    CTWindowSizeCacheTest(CTestStep* aStep);
hgs
parents:
diff changeset
    56
    ~CTWindowSizeCacheTest();
hgs
parents:
diff changeset
    57
    TestState DoTestL();
hgs
parents:
diff changeset
    58
    void ConstructL();
hgs
parents:
diff changeset
    59
//    
hgs
parents:
diff changeset
    60
    void TestCreateRWindowL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    61
    void TestCreateRBlankWindowL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    62
    void TestCreateRBackedUpWindowL(TSizeCacheStatus aEnableWindowSizeCache, TDisplayMode aDisplayMode);
hgs
parents:
diff changeset
    63
//    
hgs
parents:
diff changeset
    64
    void TestRWindowNoCacheEntryL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    65
    void TestRWindowNoCacheEntrySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    66
    void TestRWindowNoCacheEntrySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    67
    void TestRWindowNoCacheEntrySetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    68
    void TestRWindowNoCacheEntrySetSizeL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    69
    void TestRWindowNoCacheEntryEnableWindowSizeCacheL();
hgs
parents:
diff changeset
    70
//
hgs
parents:
diff changeset
    71
    void TestRWindowCacheEntryExistsCacheCleanL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    72
    void TestRWindowCacheEntryExistsCacheCleanSizeL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    73
    void TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL();
hgs
parents:
diff changeset
    74
    void TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL();
hgs
parents:
diff changeset
    75
//
hgs
parents:
diff changeset
    76
    void TestRWindowCacheEntryExistsCacheDirtySetSizeL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    77
    void TestRWindowCacheEntryExistsCacheDirtySetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    78
    void TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    79
    void TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    80
    void TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    81
    void TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    82
    void TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    83
    void TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    84
    void TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL();
hgs
parents:
diff changeset
    85
//    
hgs
parents:
diff changeset
    86
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    87
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    88
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    89
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    90
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    91
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    92
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    93
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    94
    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL();
hgs
parents:
diff changeset
    95
//
hgs
parents:
diff changeset
    96
    void TestRBlankWindowSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    97
    void TestRBackedUpWindowSetSizeErrSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
hgs
parents:
diff changeset
    98
//    
hgs
parents:
diff changeset
    99
    void SetRandomSeed(TInt64 aSeed);
hgs
parents:
diff changeset
   100
    inline TInt NextRandom(TUint aMax = 0);
hgs
parents:
diff changeset
   101
//    
hgs
parents:
diff changeset
   102
    TUint64 TestRWindowSizePerformanceL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations);
hgs
parents:
diff changeset
   103
//    
hgs
parents:
diff changeset
   104
    static void CleanupWindowPool(TAny* aPtr);
hgs
parents:
diff changeset
   105
    void RWindowPerformAction(TRWindowAction aAction, TSizeCacheStatus aEnableWindowSizeCache, RWsSession& aWs, RWindow& aWindow, TSize& aExpectedSize);
hgs
parents:
diff changeset
   106
    void TestRandomisedStressL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations);
hgs
parents:
diff changeset
   107
    void TestRandomisedStressMultiSessionL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations);
hgs
parents:
diff changeset
   108
    void TestRandomisedStressCacheEntryVolumeL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations, TUint aWindowPoolSize);
hgs
parents:
diff changeset
   109
    void TestStressEnableWindowSizeCacheL(TUint aIterations);
hgs
parents:
diff changeset
   110
    
hgs
parents:
diff changeset
   111
protected:
hgs
parents:
diff changeset
   112
//from  CTGraphicsStep
hgs
parents:
diff changeset
   113
    virtual void RunTestCaseL(TInt aCurTestCase);
hgs
parents:
diff changeset
   114
    
hgs
parents:
diff changeset
   115
private:
hgs
parents:
diff changeset
   116
    TInt64 iSeed;
hgs
parents:
diff changeset
   117
    };
hgs
parents:
diff changeset
   118
hgs
parents:
diff changeset
   119
//-----------------------------------------------------------
hgs
parents:
diff changeset
   120
inline TInt CTWindowSizeCacheTest::NextRandom(TUint aMax)
hgs
parents:
diff changeset
   121
    {
hgs
parents:
diff changeset
   122
    TInt random = Math::Rand(iSeed);
hgs
parents:
diff changeset
   123
    if (aMax != 0)
hgs
parents:
diff changeset
   124
        {
hgs
parents:
diff changeset
   125
        random = random % aMax;
hgs
parents:
diff changeset
   126
        }
hgs
parents:
diff changeset
   127
    return random;
hgs
parents:
diff changeset
   128
    }
hgs
parents:
diff changeset
   129
hgs
parents:
diff changeset
   130
//-----------------------------------------------------------
hgs
parents:
diff changeset
   131
class CTWindowSizeCacheTestStep : public CTGraphicsStep
hgs
parents:
diff changeset
   132
    {
hgs
parents:
diff changeset
   133
public:
hgs
parents:
diff changeset
   134
    CTWindowSizeCacheTestStep();
hgs
parents:
diff changeset
   135
protected:
hgs
parents:
diff changeset
   136
    //from CTGraphicsStep
hgs
parents:
diff changeset
   137
    virtual CTGraphicsBase* CreateTestL();
hgs
parents:
diff changeset
   138
    };
hgs
parents:
diff changeset
   139
hgs
parents:
diff changeset
   140
_LIT(KTWindowSizeCacheTestStep,"TWindowSizeCacheTest");
hgs
parents:
diff changeset
   141
hgs
parents:
diff changeset
   142
//-----------------------------------------------------------
hgs
parents:
diff changeset
   143
#endif // TWINDOWSIZECACHE