os/graphics/windowing/windowserver/test/tauto/twindowsizecache.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// General window tests
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @test
sl@0
    21
 @internalComponent - Internal Symbian test code
sl@0
    22
*/
sl@0
    23
sl@0
    24
#include "twindowsizecache.h"
sl@0
    25
sl@0
    26
CTWindowSizeCacheTest::CTWindowSizeCacheTest(CTestStep* aStep) : CTWsGraphicsBase(aStep)
sl@0
    27
    {}
sl@0
    28
sl@0
    29
CTWindowSizeCacheTest::~CTWindowSizeCacheTest()
sl@0
    30
    {
sl@0
    31
    }
sl@0
    32
sl@0
    33
void CTWindowSizeCacheTest::ConstructL()
sl@0
    34
    {}
sl@0
    35
sl@0
    36
sl@0
    37
void CTWindowSizeCacheTest::TestCreateRWindowL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
    38
    {
sl@0
    39
    __UHEAP_MARK;
sl@0
    40
    // w* State Initial
sl@0
    41
    RWsSession rws;
sl@0
    42
    TInt err = rws.Connect();
sl@0
    43
    CleanupClosePushL(rws);
sl@0
    44
    TEST(KErrNone == err);
sl@0
    45
sl@0
    46
    if (ETestSizeCacheEnabled == aEnableWindowSizeCache)
sl@0
    47
        {
sl@0
    48
        rws.EnableWindowSizeCacheL();
sl@0
    49
        }
sl@0
    50
    
sl@0
    51
    RWindowGroup wg(rws);
sl@0
    52
    err = wg.Construct(0);
sl@0
    53
    CleanupClosePushL(wg);
sl@0
    54
    TEST(KErrNone == err);
sl@0
    55
sl@0
    56
    // w1 State 0
sl@0
    57
    RWindow w1(rws);
sl@0
    58
    err = w1.Construct(wg,1);
sl@0
    59
    CleanupClosePushL(w1);
sl@0
    60
    TEST(KErrNone == err);
sl@0
    61
sl@0
    62
    // w2 State 0
sl@0
    63
    RWindow w2(rws);
sl@0
    64
    err = w2.Construct(wg,2);
sl@0
    65
    CleanupClosePushL(w2);
sl@0
    66
    TEST(KErrNone == err);
sl@0
    67
sl@0
    68
    CleanupStack::Pop(2);
sl@0
    69
    
sl@0
    70
    // w1 State Final
sl@0
    71
    w1.Close();
sl@0
    72
    // w2 State Final
sl@0
    73
    w2.Close();
sl@0
    74
    
sl@0
    75
    RWindow w3(rws);
sl@0
    76
    // w3 State 0
sl@0
    77
    err = w3.Construct(wg,1);
sl@0
    78
    CleanupClosePushL(w3);
sl@0
    79
    TEST(KErrNone == err);
sl@0
    80
    
sl@0
    81
    CleanupStack::Pop(2);
sl@0
    82
sl@0
    83
    // w3 State Final
sl@0
    84
    w3.Close();
sl@0
    85
    
sl@0
    86
    wg.Close();
sl@0
    87
sl@0
    88
    RWindowGroup wg2(rws);
sl@0
    89
    err = wg2.Construct(0);
sl@0
    90
    CleanupClosePushL(wg2);
sl@0
    91
    TEST(KErrNone == err);
sl@0
    92
    
sl@0
    93
    RWindowGroup wg3(rws);
sl@0
    94
    err = wg3.Construct(1);
sl@0
    95
    CleanupClosePushL(wg3);    
sl@0
    96
    TEST(KErrNone == err);
sl@0
    97
sl@0
    98
    // w4 State 0
sl@0
    99
    RWindow w4(rws);
sl@0
   100
    err = w4.Construct(wg2,2);
sl@0
   101
    CleanupClosePushL(w4);    
sl@0
   102
    TEST(KErrNone == err);
sl@0
   103
    
sl@0
   104
    // w5 State 0
sl@0
   105
    RWindow w5(rws);
sl@0
   106
    err = w5.Construct(wg3,3);
sl@0
   107
    CleanupClosePushL(w5);    
sl@0
   108
    TEST(KErrNone == err);
sl@0
   109
    
sl@0
   110
    CleanupStack::Pop(5);
sl@0
   111
sl@0
   112
    // w4 State Final
sl@0
   113
    w4.Close();
sl@0
   114
    
sl@0
   115
    // w5 State Final
sl@0
   116
    // Check nothing bad happens when calling Close more than once on RWindow
sl@0
   117
    w5.Close();
sl@0
   118
    w5.Close();
sl@0
   119
sl@0
   120
    // Check nothing bad happens when calling Close more than once on RWindowGroup
sl@0
   121
    wg2.Close();
sl@0
   122
    wg2.Close();
sl@0
   123
    
sl@0
   124
    wg3.Close();
sl@0
   125
    
sl@0
   126
    // Check nothing bad happens when calling Close more than once on RWsSession
sl@0
   127
    rws.Close();
sl@0
   128
    rws.Close();
sl@0
   129
    __UHEAP_MARKEND;
sl@0
   130
    }
sl@0
   131
sl@0
   132
void CTWindowSizeCacheTest::TestCreateRBlankWindowL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   133
    {
sl@0
   134
    __UHEAP_MARK;
sl@0
   135
    // w* State Initial
sl@0
   136
    RWsSession rws;
sl@0
   137
    TInt err = rws.Connect();
sl@0
   138
    CleanupClosePushL(rws);
sl@0
   139
    TEST(KErrNone == err);
sl@0
   140
sl@0
   141
    if (ETestSizeCacheEnabled == aEnableWindowSizeCache)
sl@0
   142
        {
sl@0
   143
        rws.EnableWindowSizeCacheL();
sl@0
   144
        }
sl@0
   145
    
sl@0
   146
    RWindowGroup wg(rws);
sl@0
   147
    err = wg.Construct(0);
sl@0
   148
    CleanupClosePushL(wg);
sl@0
   149
    TEST(KErrNone == err);
sl@0
   150
sl@0
   151
    // w1 State 0
sl@0
   152
    RBlankWindow w1(rws);
sl@0
   153
    err = w1.Construct(wg,1);
sl@0
   154
    CleanupClosePushL(w1);
sl@0
   155
    TEST(KErrNone == err);
sl@0
   156
sl@0
   157
    // w2 State 0
sl@0
   158
    RBlankWindow w2(rws);
sl@0
   159
    err = w2.Construct(wg,2);
sl@0
   160
    CleanupClosePushL(w2);
sl@0
   161
    TEST(KErrNone == err);
sl@0
   162
sl@0
   163
    CleanupStack::Pop(2);
sl@0
   164
sl@0
   165
    // w1 State Final
sl@0
   166
    w1.Close();
sl@0
   167
    // w2 State Final
sl@0
   168
    w2.Close();
sl@0
   169
    
sl@0
   170
    RBlankWindow w3(rws);
sl@0
   171
    // w3 State 0
sl@0
   172
    err = w3.Construct(wg,1);
sl@0
   173
    CleanupClosePushL(w3);
sl@0
   174
    TEST(KErrNone == err);
sl@0
   175
    
sl@0
   176
    CleanupStack::Pop(2);
sl@0
   177
    
sl@0
   178
    // w3 State Final
sl@0
   179
    w3.Close();
sl@0
   180
    
sl@0
   181
    wg.Close();
sl@0
   182
sl@0
   183
    RWindowGroup wg2(rws);
sl@0
   184
    err = wg2.Construct(0);
sl@0
   185
    CleanupClosePushL(wg2);
sl@0
   186
    TEST(KErrNone == err);
sl@0
   187
    
sl@0
   188
    RWindowGroup wg3(rws);
sl@0
   189
    err = wg3.Construct(1);
sl@0
   190
    CleanupClosePushL(wg3);    
sl@0
   191
    TEST(KErrNone == err);
sl@0
   192
sl@0
   193
    // w4 State 0
sl@0
   194
    RBlankWindow w4(rws);
sl@0
   195
    err = w4.Construct(wg2,2);
sl@0
   196
    CleanupClosePushL(w4);    
sl@0
   197
    TEST(KErrNone == err);
sl@0
   198
    
sl@0
   199
    // w5 State 0
sl@0
   200
    RBlankWindow w5(rws);
sl@0
   201
    err = w5.Construct(wg3,3);
sl@0
   202
    CleanupClosePushL(w5);    
sl@0
   203
    TEST(KErrNone == err);
sl@0
   204
    
sl@0
   205
    CleanupStack::Pop(5);
sl@0
   206
sl@0
   207
    // w4 State Final
sl@0
   208
    w4.Close();
sl@0
   209
    
sl@0
   210
    // w5 State Final
sl@0
   211
    // Check nothing bad happens when calling Close more than once on RBlankWindow
sl@0
   212
    w5.Close();
sl@0
   213
    w5.Close();
sl@0
   214
sl@0
   215
    wg2.Close();
sl@0
   216
    wg3.Close();
sl@0
   217
    rws.Close();
sl@0
   218
    __UHEAP_MARKEND;
sl@0
   219
    }
sl@0
   220
sl@0
   221
void CTWindowSizeCacheTest::TestCreateRBackedUpWindowL(TSizeCacheStatus aEnableWindowSizeCache, TDisplayMode aDisplayMode)
sl@0
   222
    {
sl@0
   223
    __UHEAP_MARK;
sl@0
   224
    // w* State Initial
sl@0
   225
    RWsSession rws;
sl@0
   226
    TInt err = rws.Connect();
sl@0
   227
    CleanupClosePushL(rws);
sl@0
   228
    TEST(KErrNone == err);
sl@0
   229
sl@0
   230
    if (ETestSizeCacheEnabled == aEnableWindowSizeCache)
sl@0
   231
        {
sl@0
   232
        rws.EnableWindowSizeCacheL();
sl@0
   233
        }
sl@0
   234
    
sl@0
   235
    RWindowGroup wg(rws);
sl@0
   236
    err = wg.Construct(0);
sl@0
   237
    CleanupClosePushL(wg);
sl@0
   238
    TEST(KErrNone == err);
sl@0
   239
sl@0
   240
    // w1 State 0
sl@0
   241
    RBackedUpWindow w1(rws);
sl@0
   242
    err = w1.Construct(wg,aDisplayMode,1);
sl@0
   243
    CleanupClosePushL(w1);
sl@0
   244
    TEST(KErrNone == err);
sl@0
   245
sl@0
   246
    // w2 State 0
sl@0
   247
    RBackedUpWindow w2(rws);
sl@0
   248
    err = w2.Construct(wg,aDisplayMode,2);
sl@0
   249
    CleanupClosePushL(w2);
sl@0
   250
    TEST(KErrNone == err);
sl@0
   251
sl@0
   252
    CleanupStack::Pop(2);
sl@0
   253
sl@0
   254
    // w1 State Final
sl@0
   255
    w1.Close();
sl@0
   256
    
sl@0
   257
    // w2 State Final
sl@0
   258
    w2.Close();
sl@0
   259
    
sl@0
   260
    RBackedUpWindow w3(rws);
sl@0
   261
    // w3 State 0
sl@0
   262
    err = w3.Construct(wg,aDisplayMode,1);
sl@0
   263
    CleanupClosePushL(w3);
sl@0
   264
    TEST(KErrNone == err);
sl@0
   265
    
sl@0
   266
    CleanupStack::Pop(2);
sl@0
   267
sl@0
   268
    // w3 State Final
sl@0
   269
    w3.Close();
sl@0
   270
    
sl@0
   271
    wg.Close();
sl@0
   272
sl@0
   273
    RWindowGroup wg2(rws);
sl@0
   274
    CleanupClosePushL(wg2);
sl@0
   275
    err = wg2.Construct(0);
sl@0
   276
    TEST(KErrNone == err);
sl@0
   277
    
sl@0
   278
    RWindowGroup wg3(rws);
sl@0
   279
    err = wg3.Construct(1);
sl@0
   280
    CleanupClosePushL(wg3);    
sl@0
   281
    TEST(KErrNone == err);
sl@0
   282
sl@0
   283
    // w4 State 0
sl@0
   284
    RBackedUpWindow w4(rws);
sl@0
   285
    err = w4.Construct(wg2,aDisplayMode,2);
sl@0
   286
    CleanupClosePushL(w4);    
sl@0
   287
    TEST(KErrNone == err);
sl@0
   288
    
sl@0
   289
    // w5 State 0
sl@0
   290
    RBackedUpWindow w5(rws);
sl@0
   291
    err = w5.Construct(wg3,aDisplayMode,3);
sl@0
   292
    CleanupClosePushL(w5);    
sl@0
   293
    TEST(KErrNone == err);
sl@0
   294
    
sl@0
   295
    CleanupStack::Pop(5);
sl@0
   296
sl@0
   297
    // w4 State Final
sl@0
   298
    w4.Close();
sl@0
   299
    
sl@0
   300
    // w5 State Final
sl@0
   301
    // Check nothing bad happens when calling Close more than once on RBackedUpWindow
sl@0
   302
    w5.Close();
sl@0
   303
    w5.Close();
sl@0
   304
sl@0
   305
    wg2.Close();
sl@0
   306
    wg3.Close();
sl@0
   307
    rws.Close();
sl@0
   308
    __UHEAP_MARKEND;
sl@0
   309
    }
sl@0
   310
sl@0
   311
void CTWindowSizeCacheTest::TestRWindowNoCacheEntryL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   312
    {
sl@0
   313
    __UHEAP_MARK;
sl@0
   314
    // w* State Initial
sl@0
   315
    RWsSession rws;
sl@0
   316
    TInt err = rws.Connect();
sl@0
   317
    CleanupClosePushL(rws);
sl@0
   318
    TEST(err==KErrNone);
sl@0
   319
sl@0
   320
    if (aEnableWindowSizeCache)
sl@0
   321
        {
sl@0
   322
        rws.EnableWindowSizeCacheL();
sl@0
   323
        }
sl@0
   324
sl@0
   325
    RWindowGroup wg(rws);
sl@0
   326
    wg.Construct(0);
sl@0
   327
    CleanupClosePushL(rws);
sl@0
   328
sl@0
   329
    // w1 State 0
sl@0
   330
    RWindow w1(rws);
sl@0
   331
    w1.Construct(wg,1);
sl@0
   332
    CleanupClosePushL(w1);
sl@0
   333
    
sl@0
   334
    // w1 State Final
sl@0
   335
    CleanupStack::Pop();
sl@0
   336
    w1.Close();
sl@0
   337
    
sl@0
   338
    CleanupStack::Pop();
sl@0
   339
    wg.Close();
sl@0
   340
    
sl@0
   341
    CleanupStack::Pop();
sl@0
   342
    rws.Close();
sl@0
   343
sl@0
   344
    __UHEAP_MARKEND;
sl@0
   345
    }
sl@0
   346
sl@0
   347
void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   348
    {
sl@0
   349
    __UHEAP_MARK;
sl@0
   350
    // w* State Initial
sl@0
   351
    RWsSession rws;
sl@0
   352
    TInt err = rws.Connect();
sl@0
   353
    CleanupClosePushL(rws);
sl@0
   354
    TEST(err==KErrNone);
sl@0
   355
sl@0
   356
    if (aEnableWindowSizeCache)
sl@0
   357
        {
sl@0
   358
        rws.EnableWindowSizeCacheL();
sl@0
   359
        }
sl@0
   360
sl@0
   361
    RWindowGroup wg(rws);
sl@0
   362
    wg.Construct(0);
sl@0
   363
    CleanupClosePushL(rws);
sl@0
   364
sl@0
   365
    // w1 State 0
sl@0
   366
    RWindow w1(rws);
sl@0
   367
    w1.Construct(wg,1);
sl@0
   368
    CleanupClosePushL(w1);
sl@0
   369
sl@0
   370
    // w1 State 0
sl@0
   371
    TPoint point1 (10101,897);
sl@0
   372
    TSize size1 (10001,123);
sl@0
   373
    err = w1.SetExtentErr(point1, size1);
sl@0
   374
    TEST(KErrNone == err);
sl@0
   375
    
sl@0
   376
    // w1 State Final
sl@0
   377
    CleanupStack::Pop();
sl@0
   378
    w1.Close();
sl@0
   379
    
sl@0
   380
    CleanupStack::Pop();
sl@0
   381
    wg.Close();
sl@0
   382
    
sl@0
   383
    CleanupStack::Pop();
sl@0
   384
    rws.Close();
sl@0
   385
sl@0
   386
    __UHEAP_MARKEND;
sl@0
   387
    }
sl@0
   388
sl@0
   389
void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   390
    {
sl@0
   391
    __UHEAP_MARK;
sl@0
   392
    // w* State Initial
sl@0
   393
    RWsSession rws;
sl@0
   394
    TInt err = rws.Connect();
sl@0
   395
    CleanupClosePushL(rws);
sl@0
   396
    TEST(err==KErrNone);
sl@0
   397
sl@0
   398
    if (aEnableWindowSizeCache)
sl@0
   399
        {
sl@0
   400
        rws.EnableWindowSizeCacheL();
sl@0
   401
        }
sl@0
   402
sl@0
   403
    RWindowGroup wg(rws);
sl@0
   404
    wg.Construct(0);
sl@0
   405
    CleanupClosePushL(rws);
sl@0
   406
sl@0
   407
    // w1 State 0
sl@0
   408
    RWindow w1(rws);
sl@0
   409
    w1.Construct(wg,1);
sl@0
   410
    CleanupClosePushL(w1);
sl@0
   411
sl@0
   412
    // w1 State 0
sl@0
   413
    TSize size1 (10001,123);
sl@0
   414
    err = w1.SetSizeErr(size1);
sl@0
   415
    TEST(KErrNone == err);
sl@0
   416
    
sl@0
   417
    // w1 State Final
sl@0
   418
    CleanupStack::Pop();
sl@0
   419
    w1.Close();
sl@0
   420
    
sl@0
   421
    CleanupStack::Pop();
sl@0
   422
    wg.Close();
sl@0
   423
    
sl@0
   424
    CleanupStack::Pop();
sl@0
   425
    rws.Close();
sl@0
   426
sl@0
   427
    __UHEAP_MARKEND;
sl@0
   428
    }
sl@0
   429
sl@0
   430
void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetExtentL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   431
    {
sl@0
   432
    __UHEAP_MARK;
sl@0
   433
    // w* State Initial
sl@0
   434
    RWsSession rws;
sl@0
   435
    TInt err = rws.Connect();
sl@0
   436
    CleanupClosePushL(rws);
sl@0
   437
    TEST(err==KErrNone);
sl@0
   438
sl@0
   439
    if (aEnableWindowSizeCache)
sl@0
   440
        {
sl@0
   441
        rws.EnableWindowSizeCacheL();
sl@0
   442
        }
sl@0
   443
sl@0
   444
    RWindowGroup wg(rws);
sl@0
   445
    wg.Construct(0);
sl@0
   446
    CleanupClosePushL(rws);
sl@0
   447
sl@0
   448
    // w1 State 0
sl@0
   449
    RWindow w1(rws);
sl@0
   450
    w1.Construct(wg,1);
sl@0
   451
    CleanupClosePushL(w1);
sl@0
   452
sl@0
   453
    // w1 State 0
sl@0
   454
    TPoint point1 (10101,897);
sl@0
   455
    TSize size1 (10001,123);
sl@0
   456
    w1.SetExtent(point1, size1);
sl@0
   457
    rws.Flush();
sl@0
   458
    
sl@0
   459
    // w1 State Final
sl@0
   460
    CleanupStack::Pop();
sl@0
   461
    w1.Close();
sl@0
   462
    
sl@0
   463
    CleanupStack::Pop();
sl@0
   464
    wg.Close();
sl@0
   465
    
sl@0
   466
    CleanupStack::Pop();
sl@0
   467
    rws.Close();
sl@0
   468
sl@0
   469
    __UHEAP_MARKEND;
sl@0
   470
    }
sl@0
   471
sl@0
   472
void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetSizeL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   473
    {
sl@0
   474
    __UHEAP_MARK;
sl@0
   475
    // w* State Initial
sl@0
   476
    RWsSession rws;
sl@0
   477
    TInt err = rws.Connect();
sl@0
   478
    CleanupClosePushL(rws);
sl@0
   479
    TEST(err==KErrNone);
sl@0
   480
sl@0
   481
    if (aEnableWindowSizeCache)
sl@0
   482
        {
sl@0
   483
        rws.EnableWindowSizeCacheL();
sl@0
   484
        }
sl@0
   485
sl@0
   486
    RWindowGroup wg(rws);
sl@0
   487
    wg.Construct(0);
sl@0
   488
    CleanupClosePushL(rws);
sl@0
   489
sl@0
   490
    // w1 State 0
sl@0
   491
    RWindow w1(rws);
sl@0
   492
    w1.Construct(wg,1);
sl@0
   493
    CleanupClosePushL(w1);
sl@0
   494
sl@0
   495
    // w1 State 0
sl@0
   496
    TSize size1 (10001,123);
sl@0
   497
    w1.SetSize(size1);
sl@0
   498
    rws.Flush();
sl@0
   499
    
sl@0
   500
    // w1 State Final
sl@0
   501
    CleanupStack::Pop();
sl@0
   502
    w1.Close();
sl@0
   503
    
sl@0
   504
    CleanupStack::Pop();
sl@0
   505
    wg.Close();
sl@0
   506
    
sl@0
   507
    CleanupStack::Pop();
sl@0
   508
    rws.Close();
sl@0
   509
sl@0
   510
    __UHEAP_MARKEND;
sl@0
   511
    }
sl@0
   512
sl@0
   513
void CTWindowSizeCacheTest::TestRWindowNoCacheEntryEnableWindowSizeCacheL()
sl@0
   514
    {
sl@0
   515
    __UHEAP_MARK;
sl@0
   516
    // w* State Initial
sl@0
   517
    RWsSession rws;
sl@0
   518
    TInt err = rws.Connect();
sl@0
   519
    CleanupClosePushL(rws);
sl@0
   520
    TEST(err==KErrNone);
sl@0
   521
sl@0
   522
    rws.EnableWindowSizeCacheL();
sl@0
   523
sl@0
   524
    RWindowGroup wg(rws);
sl@0
   525
    wg.Construct(0);
sl@0
   526
    CleanupClosePushL(rws);
sl@0
   527
sl@0
   528
    // w1 State 0
sl@0
   529
    RWindow w1(rws);
sl@0
   530
    w1.Construct(wg,1);
sl@0
   531
    CleanupClosePushL(w1);
sl@0
   532
sl@0
   533
    // w1 State 0
sl@0
   534
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
   535
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
   536
    rws.EnableWindowSizeCacheL();
sl@0
   537
    
sl@0
   538
    // w1 State Final
sl@0
   539
    CleanupStack::Pop();
sl@0
   540
    w1.Close();
sl@0
   541
    
sl@0
   542
    CleanupStack::Pop();
sl@0
   543
    wg.Close();
sl@0
   544
    
sl@0
   545
    CleanupStack::Pop();
sl@0
   546
    rws.Close();
sl@0
   547
sl@0
   548
    __UHEAP_MARKEND;
sl@0
   549
    }
sl@0
   550
sl@0
   551
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   552
    {
sl@0
   553
    __UHEAP_MARK;
sl@0
   554
    // w* State Initial
sl@0
   555
    RWsSession rws;
sl@0
   556
    TInt err = rws.Connect();
sl@0
   557
    CleanupClosePushL(rws);
sl@0
   558
    TEST(err==KErrNone);
sl@0
   559
sl@0
   560
    if (aEnableWindowSizeCache)
sl@0
   561
        {
sl@0
   562
        rws.EnableWindowSizeCacheL();
sl@0
   563
        }
sl@0
   564
sl@0
   565
    RWindowGroup wg(rws);
sl@0
   566
    wg.Construct(0);
sl@0
   567
    CleanupClosePushL(rws);
sl@0
   568
sl@0
   569
    // w1 State 0
sl@0
   570
    RWindow w1(rws);
sl@0
   571
    w1.Construct(wg,1);
sl@0
   572
    CleanupClosePushL(w1);
sl@0
   573
sl@0
   574
    // w1 State 0
sl@0
   575
    TSize size1 (10001,123);
sl@0
   576
    w1.SetSize(size1);
sl@0
   577
    rws.Flush();
sl@0
   578
    
sl@0
   579
    // w1 State 1
sl@0
   580
    TSize retSize1 = w1.Size();
sl@0
   581
    TEST(retSize1 == size1);
sl@0
   582
    
sl@0
   583
    // w1 State Final
sl@0
   584
    CleanupStack::Pop();
sl@0
   585
    w1.Close();
sl@0
   586
    
sl@0
   587
    CleanupStack::Pop();
sl@0
   588
    wg.Close();
sl@0
   589
    
sl@0
   590
    CleanupStack::Pop();
sl@0
   591
    rws.Close();
sl@0
   592
sl@0
   593
    __UHEAP_MARKEND;
sl@0
   594
    }
sl@0
   595
sl@0
   596
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanSizeL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   597
    {
sl@0
   598
    __UHEAP_MARK;
sl@0
   599
    // w* State Initial
sl@0
   600
    RWsSession rws;
sl@0
   601
    TInt err = rws.Connect();
sl@0
   602
    CleanupClosePushL(rws);
sl@0
   603
    TEST(err==KErrNone);
sl@0
   604
sl@0
   605
    if (aEnableWindowSizeCache)
sl@0
   606
        {
sl@0
   607
        rws.EnableWindowSizeCacheL();
sl@0
   608
        }
sl@0
   609
sl@0
   610
    RWindowGroup wg(rws);
sl@0
   611
    wg.Construct(0);
sl@0
   612
    CleanupClosePushL(rws);
sl@0
   613
sl@0
   614
    // w1 State 0
sl@0
   615
    RWindow w1(rws);
sl@0
   616
    w1.Construct(wg,1);
sl@0
   617
    CleanupClosePushL(w1);
sl@0
   618
sl@0
   619
    // w1 State 0
sl@0
   620
    TSize size1 (10001,123);
sl@0
   621
    w1.SetSize(size1);
sl@0
   622
    rws.Flush();
sl@0
   623
    
sl@0
   624
    // w1 State 1
sl@0
   625
    TSize retSize1 = w1.Size();
sl@0
   626
    TEST(retSize1 == size1);
sl@0
   627
    
sl@0
   628
    // w1 State 1
sl@0
   629
    TSize retSize2 = w1.Size();
sl@0
   630
    TEST(retSize2 == size1);
sl@0
   631
sl@0
   632
    // w1 State Final
sl@0
   633
    CleanupStack::Pop();
sl@0
   634
    w1.Close();
sl@0
   635
    
sl@0
   636
    CleanupStack::Pop();
sl@0
   637
    wg.Close();
sl@0
   638
    
sl@0
   639
    CleanupStack::Pop();
sl@0
   640
    rws.Close();
sl@0
   641
sl@0
   642
    __UHEAP_MARKEND;
sl@0
   643
    }
sl@0
   644
sl@0
   645
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL()
sl@0
   646
    {
sl@0
   647
    __UHEAP_MARK;
sl@0
   648
    // w* State Initial
sl@0
   649
    RWsSession rws;
sl@0
   650
    TInt err = rws.Connect();
sl@0
   651
    CleanupClosePushL(rws);
sl@0
   652
    TEST(err==KErrNone);
sl@0
   653
sl@0
   654
    rws.EnableWindowSizeCacheL();
sl@0
   655
sl@0
   656
    RWindowGroup wg(rws);
sl@0
   657
    wg.Construct(0);
sl@0
   658
    CleanupClosePushL(rws);
sl@0
   659
sl@0
   660
    // w1 State 0
sl@0
   661
    RWindow w1(rws);
sl@0
   662
    w1.Construct(wg,1);
sl@0
   663
    CleanupClosePushL(w1);
sl@0
   664
sl@0
   665
    // w1 State 0
sl@0
   666
    TSize size1 (10001,123);
sl@0
   667
    w1.SetSize(size1);
sl@0
   668
    rws.Flush();
sl@0
   669
    
sl@0
   670
    // w1 State 1
sl@0
   671
    TSize retSize1 = w1.Size();
sl@0
   672
    TEST(retSize1 == size1);
sl@0
   673
    
sl@0
   674
    // w1 State 1
sl@0
   675
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
   676
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
   677
    rws.EnableWindowSizeCacheL();
sl@0
   678
sl@0
   679
    // w1 State Final
sl@0
   680
    CleanupStack::Pop();
sl@0
   681
    w1.Close();
sl@0
   682
    
sl@0
   683
    CleanupStack::Pop();
sl@0
   684
    wg.Close();
sl@0
   685
    
sl@0
   686
    CleanupStack::Pop();
sl@0
   687
    rws.Close();
sl@0
   688
sl@0
   689
    __UHEAP_MARKEND;
sl@0
   690
    }
sl@0
   691
sl@0
   692
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL()
sl@0
   693
    {
sl@0
   694
    __UHEAP_MARK;
sl@0
   695
    // w* State Initial
sl@0
   696
    RWsSession rws;
sl@0
   697
    TInt err = rws.Connect();
sl@0
   698
    CleanupClosePushL(rws);
sl@0
   699
    TEST(err==KErrNone);
sl@0
   700
sl@0
   701
    rws.EnableWindowSizeCacheL();
sl@0
   702
sl@0
   703
    RWindowGroup wg(rws);
sl@0
   704
    wg.Construct(0);
sl@0
   705
    CleanupClosePushL(rws);
sl@0
   706
sl@0
   707
    // w1 State 0
sl@0
   708
    RWindow w1(rws);
sl@0
   709
    w1.Construct(wg,1);
sl@0
   710
    CleanupClosePushL(w1);
sl@0
   711
sl@0
   712
    // w1 State 0
sl@0
   713
    TSize size1 (10001,123);
sl@0
   714
    w1.SetSize(size1);
sl@0
   715
    rws.Flush();
sl@0
   716
    
sl@0
   717
    // w1 State 1
sl@0
   718
    TSize retSize1 = w1.Size();
sl@0
   719
    TEST(retSize1 == size1);
sl@0
   720
    
sl@0
   721
    // w1 State 1
sl@0
   722
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
   723
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
   724
    rws.EnableWindowSizeCacheL();
sl@0
   725
sl@0
   726
    // w1 State 1
sl@0
   727
    TSize retSize2 = w1.Size();
sl@0
   728
    TEST(retSize2 == size1);
sl@0
   729
sl@0
   730
    // w1 State Final
sl@0
   731
    CleanupStack::Pop();
sl@0
   732
    w1.Close();
sl@0
   733
    
sl@0
   734
    CleanupStack::Pop();
sl@0
   735
    wg.Close();
sl@0
   736
    
sl@0
   737
    CleanupStack::Pop();
sl@0
   738
    rws.Close();
sl@0
   739
sl@0
   740
    __UHEAP_MARKEND;
sl@0
   741
    }
sl@0
   742
sl@0
   743
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   744
    {
sl@0
   745
    __UHEAP_MARK;
sl@0
   746
    // w* State Initial
sl@0
   747
    RWsSession rws;
sl@0
   748
    TInt err = rws.Connect();
sl@0
   749
    CleanupClosePushL(rws);
sl@0
   750
    TEST(err==KErrNone);
sl@0
   751
sl@0
   752
    if (aEnableWindowSizeCache)
sl@0
   753
        {
sl@0
   754
        rws.EnableWindowSizeCacheL();
sl@0
   755
        }
sl@0
   756
sl@0
   757
    RWindowGroup wg(rws);
sl@0
   758
    wg.Construct(0);
sl@0
   759
    CleanupClosePushL(rws);
sl@0
   760
sl@0
   761
    // w1 State 0
sl@0
   762
    RWindow w1(rws);
sl@0
   763
    w1.Construct(wg,1);
sl@0
   764
    CleanupClosePushL(w1);
sl@0
   765
sl@0
   766
    // w1 State 0
sl@0
   767
    TSize size1 (10001,123);
sl@0
   768
    w1.SetSize(size1);
sl@0
   769
    rws.Flush();
sl@0
   770
    
sl@0
   771
    // w1 State 1
sl@0
   772
    TSize retSize1 = w1.Size();
sl@0
   773
    TEST(retSize1 == size1);
sl@0
   774
    
sl@0
   775
    // w1 State 2
sl@0
   776
    TSize size2 (20002,223);
sl@0
   777
    w1.SetSize(size2); 
sl@0
   778
    rws.Flush();
sl@0
   779
sl@0
   780
    // w1 State Final
sl@0
   781
    CleanupStack::Pop();
sl@0
   782
    w1.Close();
sl@0
   783
    
sl@0
   784
    CleanupStack::Pop();
sl@0
   785
    wg.Close();
sl@0
   786
    
sl@0
   787
    CleanupStack::Pop();
sl@0
   788
    rws.Close();
sl@0
   789
sl@0
   790
    __UHEAP_MARKEND;
sl@0
   791
    }
sl@0
   792
sl@0
   793
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetExtentL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   794
    {
sl@0
   795
    __UHEAP_MARK;
sl@0
   796
    // w* State Initial
sl@0
   797
    RWsSession rws;
sl@0
   798
    TInt err = rws.Connect();
sl@0
   799
    CleanupClosePushL(rws);
sl@0
   800
    TEST(err==KErrNone);
sl@0
   801
sl@0
   802
    if (aEnableWindowSizeCache)
sl@0
   803
        {
sl@0
   804
        rws.EnableWindowSizeCacheL();
sl@0
   805
        }
sl@0
   806
sl@0
   807
    RWindowGroup wg(rws);
sl@0
   808
    wg.Construct(0);
sl@0
   809
    CleanupClosePushL(rws);
sl@0
   810
sl@0
   811
    // w1 State 0
sl@0
   812
    RWindow w1(rws);
sl@0
   813
    w1.Construct(wg,1);
sl@0
   814
    CleanupClosePushL(w1);
sl@0
   815
sl@0
   816
    // w1 State 0
sl@0
   817
    TSize size1 (10001,123);
sl@0
   818
    w1.SetSize(size1);
sl@0
   819
    rws.Flush();
sl@0
   820
    
sl@0
   821
    // w1 State 1
sl@0
   822
    TSize retSize1 = w1.Size();
sl@0
   823
    TEST(retSize1 == size1);
sl@0
   824
    
sl@0
   825
    // w1 State 2
sl@0
   826
    TPoint point2 (20202,223);
sl@0
   827
    TSize size2 (20002,223);
sl@0
   828
    w1.SetExtent(point2, size2); 
sl@0
   829
    rws.Flush();
sl@0
   830
sl@0
   831
    // w1 State Final
sl@0
   832
    CleanupStack::Pop();
sl@0
   833
    w1.Close();
sl@0
   834
    
sl@0
   835
    CleanupStack::Pop();
sl@0
   836
    wg.Close();
sl@0
   837
    
sl@0
   838
    CleanupStack::Pop();
sl@0
   839
    rws.Close();
sl@0
   840
sl@0
   841
    __UHEAP_MARKEND;
sl@0
   842
    }
sl@0
   843
sl@0
   844
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   845
    {
sl@0
   846
    __UHEAP_MARK;
sl@0
   847
    // w* State Initial
sl@0
   848
    RWsSession rws;
sl@0
   849
    TInt err = rws.Connect();
sl@0
   850
    CleanupClosePushL(rws);
sl@0
   851
    TEST(err==KErrNone);
sl@0
   852
sl@0
   853
    if (aEnableWindowSizeCache)
sl@0
   854
        {
sl@0
   855
        rws.EnableWindowSizeCacheL();
sl@0
   856
        }
sl@0
   857
sl@0
   858
    RWindowGroup wg(rws);
sl@0
   859
    wg.Construct(0);
sl@0
   860
    CleanupClosePushL(rws);
sl@0
   861
sl@0
   862
    // w1 State 0
sl@0
   863
    RWindow w1(rws);
sl@0
   864
    w1.Construct(wg,1);
sl@0
   865
    CleanupClosePushL(w1);
sl@0
   866
sl@0
   867
    // w1 State 0
sl@0
   868
    TSize size1 (10001,123);
sl@0
   869
    w1.SetSize(size1);
sl@0
   870
    rws.Flush();
sl@0
   871
    
sl@0
   872
    // w1 State 1
sl@0
   873
    TSize retSize1 = w1.Size();
sl@0
   874
    TEST(retSize1 == size1);
sl@0
   875
    
sl@0
   876
    // w1 State 2
sl@0
   877
    TSize size2 (20002,223);
sl@0
   878
    err = w1.SetSizeErr(size2); 
sl@0
   879
    TEST(KErrNone == err);
sl@0
   880
sl@0
   881
    // w1 State Final
sl@0
   882
    CleanupStack::Pop();
sl@0
   883
    w1.Close();
sl@0
   884
    
sl@0
   885
    CleanupStack::Pop();
sl@0
   886
    wg.Close();
sl@0
   887
    
sl@0
   888
    CleanupStack::Pop();
sl@0
   889
    rws.Close();
sl@0
   890
sl@0
   891
    __UHEAP_MARKEND;
sl@0
   892
    }
sl@0
   893
sl@0
   894
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   895
    {
sl@0
   896
    __UHEAP_MARK;
sl@0
   897
    // w* State Initial
sl@0
   898
    RWsSession rws;
sl@0
   899
    TInt err = rws.Connect();
sl@0
   900
    CleanupClosePushL(rws);
sl@0
   901
    TEST(err==KErrNone);
sl@0
   902
sl@0
   903
    if (aEnableWindowSizeCache)
sl@0
   904
        {
sl@0
   905
        rws.EnableWindowSizeCacheL();
sl@0
   906
        }
sl@0
   907
sl@0
   908
    RWindowGroup wg(rws);
sl@0
   909
    wg.Construct(0);
sl@0
   910
    CleanupClosePushL(rws);
sl@0
   911
sl@0
   912
    // w1 State 0
sl@0
   913
    RWindow w1(rws);
sl@0
   914
    w1.Construct(wg,1);
sl@0
   915
    CleanupClosePushL(w1);
sl@0
   916
sl@0
   917
    // w1 State 0
sl@0
   918
    TSize size1 (10001,123);
sl@0
   919
    w1.SetSize(size1);
sl@0
   920
    rws.Flush();
sl@0
   921
    
sl@0
   922
    // w1 State 1
sl@0
   923
    TSize retSize1 = w1.Size();
sl@0
   924
    TEST(retSize1 == size1);
sl@0
   925
    
sl@0
   926
    // w1 State 2
sl@0
   927
    TPoint point2 (20202,223);
sl@0
   928
    TSize size2 (20002,223);
sl@0
   929
    err = w1.SetExtentErr(point2, size2); 
sl@0
   930
    TEST(KErrNone == err);
sl@0
   931
sl@0
   932
    // w1 State Final
sl@0
   933
    CleanupStack::Pop();
sl@0
   934
    w1.Close();
sl@0
   935
    
sl@0
   936
    CleanupStack::Pop();
sl@0
   937
    wg.Close();
sl@0
   938
    
sl@0
   939
    CleanupStack::Pop();
sl@0
   940
    rws.Close();
sl@0
   941
sl@0
   942
    __UHEAP_MARKEND;
sl@0
   943
    }
sl@0
   944
sl@0
   945
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
   946
    {
sl@0
   947
    __UHEAP_MARK;
sl@0
   948
    // w* State Initial
sl@0
   949
    RWsSession rws;
sl@0
   950
    TInt err = rws.Connect();
sl@0
   951
    CleanupClosePushL(rws);
sl@0
   952
    TEST(err==KErrNone);
sl@0
   953
sl@0
   954
    if (aEnableWindowSizeCache)
sl@0
   955
        {
sl@0
   956
        rws.EnableWindowSizeCacheL();
sl@0
   957
        }
sl@0
   958
sl@0
   959
    RWindowGroup wg(rws);
sl@0
   960
    wg.Construct(0);
sl@0
   961
    CleanupClosePushL(rws);
sl@0
   962
sl@0
   963
    // w1 State 0
sl@0
   964
    RWindow w1(rws);
sl@0
   965
    w1.Construct(wg,1);
sl@0
   966
    CleanupClosePushL(w1);
sl@0
   967
sl@0
   968
    // w1 State 0
sl@0
   969
    TSize size1 (10001,123);
sl@0
   970
    w1.SetSize(size1);
sl@0
   971
    rws.Flush();
sl@0
   972
    
sl@0
   973
    // w1 State 1
sl@0
   974
    TSize retSize1 = w1.Size();
sl@0
   975
    TEST(retSize1 == size1);
sl@0
   976
    
sl@0
   977
    // w1 State 2
sl@0
   978
    TSize size2 (20002,223);
sl@0
   979
    w1.SetSize(size2); 
sl@0
   980
sl@0
   981
    TSize size3 (30003,323);
sl@0
   982
    // w1 State 2
sl@0
   983
    w1.SetSize(size3); 
sl@0
   984
    rws.Flush();
sl@0
   985
sl@0
   986
    // w1 State Final
sl@0
   987
    CleanupStack::Pop();
sl@0
   988
    w1.Close();
sl@0
   989
    
sl@0
   990
    CleanupStack::Pop();
sl@0
   991
    wg.Close();
sl@0
   992
    
sl@0
   993
    CleanupStack::Pop();
sl@0
   994
    rws.Close();
sl@0
   995
sl@0
   996
    __UHEAP_MARKEND;
sl@0
   997
    }
sl@0
   998
sl@0
   999
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1000
    {
sl@0
  1001
    __UHEAP_MARK;
sl@0
  1002
    // w* State Initial
sl@0
  1003
    RWsSession rws;
sl@0
  1004
    TInt err = rws.Connect();
sl@0
  1005
    CleanupClosePushL(rws);
sl@0
  1006
    TEST(err==KErrNone);
sl@0
  1007
sl@0
  1008
    if (aEnableWindowSizeCache)
sl@0
  1009
        {
sl@0
  1010
        rws.EnableWindowSizeCacheL();
sl@0
  1011
        }
sl@0
  1012
sl@0
  1013
    RWindowGroup wg(rws);
sl@0
  1014
    wg.Construct(0);
sl@0
  1015
    CleanupClosePushL(rws);
sl@0
  1016
sl@0
  1017
    // w1 State 0
sl@0
  1018
    RWindow w1(rws);
sl@0
  1019
    w1.Construct(wg,1);
sl@0
  1020
    CleanupClosePushL(w1);
sl@0
  1021
sl@0
  1022
    // w1 State 0
sl@0
  1023
    TSize size1 (10001,123);
sl@0
  1024
    w1.SetSize(size1);
sl@0
  1025
    rws.Flush();
sl@0
  1026
    
sl@0
  1027
    // w1 State 1
sl@0
  1028
    TSize retSize1 = w1.Size();
sl@0
  1029
    TEST(retSize1 == size1);
sl@0
  1030
    
sl@0
  1031
    // w1 State 2
sl@0
  1032
    TSize size2 (20002,223);
sl@0
  1033
    w1.SetSize(size2); 
sl@0
  1034
sl@0
  1035
    // w1 State 2
sl@0
  1036
    TPoint point3 (30303,232);
sl@0
  1037
    TSize size3 (30003,323);
sl@0
  1038
    w1.SetExtent(point3, size3); 
sl@0
  1039
    rws.Flush();
sl@0
  1040
sl@0
  1041
    // w1 State Final
sl@0
  1042
    CleanupStack::Pop();
sl@0
  1043
    w1.Close();
sl@0
  1044
    
sl@0
  1045
    CleanupStack::Pop();
sl@0
  1046
    wg.Close();
sl@0
  1047
    
sl@0
  1048
    CleanupStack::Pop();
sl@0
  1049
    rws.Close();
sl@0
  1050
sl@0
  1051
    __UHEAP_MARKEND;
sl@0
  1052
    }
sl@0
  1053
sl@0
  1054
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1055
    {
sl@0
  1056
    __UHEAP_MARK;
sl@0
  1057
    // w* State Initial
sl@0
  1058
    RWsSession rws;
sl@0
  1059
    TInt err = rws.Connect();
sl@0
  1060
    CleanupClosePushL(rws);
sl@0
  1061
    TEST(err==KErrNone);
sl@0
  1062
sl@0
  1063
    if (aEnableWindowSizeCache)
sl@0
  1064
        {
sl@0
  1065
        rws.EnableWindowSizeCacheL();
sl@0
  1066
        }
sl@0
  1067
sl@0
  1068
    RWindowGroup wg(rws);
sl@0
  1069
    wg.Construct(0);
sl@0
  1070
    CleanupClosePushL(rws);
sl@0
  1071
sl@0
  1072
    // w1 State 0
sl@0
  1073
    RWindow w1(rws);
sl@0
  1074
    w1.Construct(wg,1);
sl@0
  1075
    CleanupClosePushL(w1);
sl@0
  1076
sl@0
  1077
    // w1 State 0
sl@0
  1078
    TSize size1 (10001,123);
sl@0
  1079
    w1.SetSize(size1);
sl@0
  1080
    rws.Flush();
sl@0
  1081
    
sl@0
  1082
    // w1 State 1
sl@0
  1083
    TSize retSize1 = w1.Size();
sl@0
  1084
    TEST(retSize1 == size1);
sl@0
  1085
    
sl@0
  1086
    // w1 State 2
sl@0
  1087
    TSize size2 (20002,223);
sl@0
  1088
    w1.SetSize(size2); 
sl@0
  1089
sl@0
  1090
    // w1 State 2
sl@0
  1091
    TSize size3 (30003,323);
sl@0
  1092
    err = w1.SetSizeErr(size3);
sl@0
  1093
    TEST(KErrNone == err);
sl@0
  1094
sl@0
  1095
    // w1 State Final
sl@0
  1096
    CleanupStack::Pop();
sl@0
  1097
    w1.Close();
sl@0
  1098
    
sl@0
  1099
    CleanupStack::Pop();
sl@0
  1100
    wg.Close();
sl@0
  1101
    
sl@0
  1102
    CleanupStack::Pop();
sl@0
  1103
    rws.Close();
sl@0
  1104
sl@0
  1105
    __UHEAP_MARKEND;
sl@0
  1106
    }
sl@0
  1107
sl@0
  1108
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1109
    {
sl@0
  1110
    __UHEAP_MARK;
sl@0
  1111
    // w* State Initial
sl@0
  1112
    RWsSession rws;
sl@0
  1113
    TInt err = rws.Connect();
sl@0
  1114
    CleanupClosePushL(rws);
sl@0
  1115
    TEST(err==KErrNone);
sl@0
  1116
sl@0
  1117
    if (aEnableWindowSizeCache)
sl@0
  1118
        {
sl@0
  1119
        rws.EnableWindowSizeCacheL();
sl@0
  1120
        }
sl@0
  1121
sl@0
  1122
    RWindowGroup wg(rws);
sl@0
  1123
    wg.Construct(0);
sl@0
  1124
    CleanupClosePushL(rws);
sl@0
  1125
sl@0
  1126
    // w1 State 0
sl@0
  1127
    RWindow w1(rws);
sl@0
  1128
    w1.Construct(wg,1);
sl@0
  1129
    CleanupClosePushL(w1);
sl@0
  1130
sl@0
  1131
    // w1 State 0
sl@0
  1132
    TSize size1 (10001,123);
sl@0
  1133
    w1.SetSize(size1);
sl@0
  1134
    rws.Flush();
sl@0
  1135
    
sl@0
  1136
    // w1 State 1
sl@0
  1137
    TSize retSize1 = w1.Size();
sl@0
  1138
    TEST(retSize1 == size1);
sl@0
  1139
    
sl@0
  1140
    // w1 State 2
sl@0
  1141
    TSize size2 (20002,223);
sl@0
  1142
    w1.SetSize(size2); 
sl@0
  1143
sl@0
  1144
    // w1 State 2
sl@0
  1145
    TPoint point3 (30303,232);
sl@0
  1146
    TSize size3 (30003,323);
sl@0
  1147
    err = w1.SetExtentErr(point3, size3); 
sl@0
  1148
    TEST(KErrNone == err);
sl@0
  1149
sl@0
  1150
    // w1 State Final
sl@0
  1151
    CleanupStack::Pop();
sl@0
  1152
    w1.Close();
sl@0
  1153
    
sl@0
  1154
    CleanupStack::Pop();
sl@0
  1155
    wg.Close();
sl@0
  1156
    
sl@0
  1157
    CleanupStack::Pop();
sl@0
  1158
    rws.Close();
sl@0
  1159
sl@0
  1160
    __UHEAP_MARKEND;
sl@0
  1161
    }
sl@0
  1162
sl@0
  1163
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL()
sl@0
  1164
    {
sl@0
  1165
    __UHEAP_MARK;
sl@0
  1166
    // w* State Initial
sl@0
  1167
    RWsSession rws;
sl@0
  1168
    TInt err = rws.Connect();
sl@0
  1169
    CleanupClosePushL(rws);
sl@0
  1170
    TEST(err==KErrNone);
sl@0
  1171
sl@0
  1172
    rws.EnableWindowSizeCacheL();
sl@0
  1173
sl@0
  1174
    RWindowGroup wg(rws);
sl@0
  1175
    wg.Construct(0);
sl@0
  1176
    CleanupClosePushL(rws);
sl@0
  1177
sl@0
  1178
    // w1 State 0
sl@0
  1179
    RWindow w1(rws);
sl@0
  1180
    w1.Construct(wg,1);
sl@0
  1181
    CleanupClosePushL(w1);
sl@0
  1182
sl@0
  1183
    // w1 State 0
sl@0
  1184
    TSize size1 (10001,123);
sl@0
  1185
    w1.SetSize(size1);
sl@0
  1186
    rws.Flush();
sl@0
  1187
    
sl@0
  1188
    // w1 State 1
sl@0
  1189
    TSize retSize1 = w1.Size();
sl@0
  1190
    TEST(retSize1 == size1);
sl@0
  1191
    
sl@0
  1192
    // w1 State 2
sl@0
  1193
    TSize size2 (20002,223);
sl@0
  1194
    w1.SetSize(size2); 
sl@0
  1195
sl@0
  1196
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
  1197
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
  1198
    rws.EnableWindowSizeCacheL();
sl@0
  1199
sl@0
  1200
    // w1 State Final
sl@0
  1201
    CleanupStack::Pop();
sl@0
  1202
    w1.Close();
sl@0
  1203
    
sl@0
  1204
    CleanupStack::Pop();
sl@0
  1205
    wg.Close();
sl@0
  1206
    
sl@0
  1207
    CleanupStack::Pop();
sl@0
  1208
    rws.Close();
sl@0
  1209
sl@0
  1210
    __UHEAP_MARKEND;
sl@0
  1211
    }
sl@0
  1212
sl@0
  1213
//-------------------------------------------------------------------------------------------
sl@0
  1214
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1215
    {
sl@0
  1216
    __UHEAP_MARK;
sl@0
  1217
    // w* State Initial
sl@0
  1218
    RWsSession rws;
sl@0
  1219
    TInt err = rws.Connect();
sl@0
  1220
    CleanupClosePushL(rws);
sl@0
  1221
    TEST(err==KErrNone);
sl@0
  1222
sl@0
  1223
    if (aEnableWindowSizeCache)
sl@0
  1224
        {
sl@0
  1225
        rws.EnableWindowSizeCacheL();
sl@0
  1226
        }
sl@0
  1227
sl@0
  1228
    RWindowGroup wg(rws);
sl@0
  1229
    wg.Construct(0);
sl@0
  1230
    CleanupClosePushL(rws);
sl@0
  1231
sl@0
  1232
    // w1 State 0
sl@0
  1233
    RWindow w1(rws);
sl@0
  1234
    w1.Construct(wg,1);
sl@0
  1235
    CleanupClosePushL(w1);
sl@0
  1236
sl@0
  1237
    // w1 State 0
sl@0
  1238
    TSize size1 (10001,123);
sl@0
  1239
    w1.SetSize(size1);
sl@0
  1240
    rws.Flush();
sl@0
  1241
    
sl@0
  1242
    // w1 State 1
sl@0
  1243
    TSize retSize1 = w1.Size();
sl@0
  1244
    TEST(retSize1 == size1);
sl@0
  1245
    
sl@0
  1246
    // w1 State 2
sl@0
  1247
    TSize size2 (20002,223);
sl@0
  1248
    w1.SetSize(size2); 
sl@0
  1249
    rws.Flush();
sl@0
  1250
sl@0
  1251
    // w1 State 1
sl@0
  1252
    TSize retSize2 = w1.Size();
sl@0
  1253
    TEST(retSize2 == size2);
sl@0
  1254
sl@0
  1255
    // w1 State Final
sl@0
  1256
    CleanupStack::Pop();
sl@0
  1257
    w1.Close();
sl@0
  1258
    
sl@0
  1259
    CleanupStack::Pop();
sl@0
  1260
    wg.Close();
sl@0
  1261
    
sl@0
  1262
    CleanupStack::Pop();
sl@0
  1263
    rws.Close();
sl@0
  1264
sl@0
  1265
    __UHEAP_MARKEND;
sl@0
  1266
    }
sl@0
  1267
sl@0
  1268
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1269
    {
sl@0
  1270
    __UHEAP_MARK;
sl@0
  1271
    // w* State Initial
sl@0
  1272
    RWsSession rws;
sl@0
  1273
    TInt err = rws.Connect();
sl@0
  1274
    CleanupClosePushL(rws);
sl@0
  1275
    TEST(err==KErrNone);
sl@0
  1276
sl@0
  1277
    if (aEnableWindowSizeCache)
sl@0
  1278
        {
sl@0
  1279
        rws.EnableWindowSizeCacheL();
sl@0
  1280
        }
sl@0
  1281
sl@0
  1282
    RWindowGroup wg(rws);
sl@0
  1283
    wg.Construct(0);
sl@0
  1284
    CleanupClosePushL(rws);
sl@0
  1285
sl@0
  1286
    // w1 State 0
sl@0
  1287
    RWindow w1(rws);
sl@0
  1288
    w1.Construct(wg,1);
sl@0
  1289
    CleanupClosePushL(w1);
sl@0
  1290
sl@0
  1291
    // w1 State 0
sl@0
  1292
    TSize size1 (10001,123);
sl@0
  1293
    w1.SetSize(size1);
sl@0
  1294
    rws.Flush();
sl@0
  1295
    
sl@0
  1296
    // w1 State 1
sl@0
  1297
    TSize retSize1 = w1.Size();
sl@0
  1298
    TEST(retSize1 == size1);
sl@0
  1299
    
sl@0
  1300
    // w1 State 2
sl@0
  1301
    TPoint point2 (20202,223);
sl@0
  1302
    TSize size2 (20002,223);
sl@0
  1303
    w1.SetExtent(point2, size2); 
sl@0
  1304
    rws.Flush();
sl@0
  1305
sl@0
  1306
    // w1 State 1
sl@0
  1307
    TSize retSize2 = w1.Size();
sl@0
  1308
    TEST(retSize2 == size2);
sl@0
  1309
sl@0
  1310
    // w1 State Final
sl@0
  1311
    CleanupStack::Pop();
sl@0
  1312
    w1.Close();
sl@0
  1313
    
sl@0
  1314
    CleanupStack::Pop();
sl@0
  1315
    wg.Close();
sl@0
  1316
    
sl@0
  1317
    CleanupStack::Pop();
sl@0
  1318
    rws.Close();
sl@0
  1319
sl@0
  1320
    __UHEAP_MARKEND;
sl@0
  1321
    }
sl@0
  1322
sl@0
  1323
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1324
    {
sl@0
  1325
    __UHEAP_MARK;
sl@0
  1326
    // w* State Initial
sl@0
  1327
    RWsSession rws;
sl@0
  1328
    TInt err = rws.Connect();
sl@0
  1329
    CleanupClosePushL(rws);
sl@0
  1330
    TEST(err==KErrNone);
sl@0
  1331
sl@0
  1332
    if (aEnableWindowSizeCache)
sl@0
  1333
        {
sl@0
  1334
        rws.EnableWindowSizeCacheL();
sl@0
  1335
        }
sl@0
  1336
sl@0
  1337
    RWindowGroup wg(rws);
sl@0
  1338
    wg.Construct(0);
sl@0
  1339
    CleanupClosePushL(rws);
sl@0
  1340
sl@0
  1341
    // w1 State 0
sl@0
  1342
    RWindow w1(rws);
sl@0
  1343
    w1.Construct(wg,1);
sl@0
  1344
    CleanupClosePushL(w1);
sl@0
  1345
sl@0
  1346
    // w1 State 0
sl@0
  1347
    TSize size1 (10001,123);
sl@0
  1348
    w1.SetSize(size1);
sl@0
  1349
    rws.Flush();
sl@0
  1350
    
sl@0
  1351
    // w1 State 1
sl@0
  1352
    TSize retSize1 = w1.Size();
sl@0
  1353
    TEST(retSize1 == size1);
sl@0
  1354
    
sl@0
  1355
    // w1 State 2
sl@0
  1356
    TSize size2 (20002,223);
sl@0
  1357
    err = w1.SetSizeErr(size2); 
sl@0
  1358
    TEST(KErrNone == err);
sl@0
  1359
sl@0
  1360
    // w1 State 1
sl@0
  1361
    TSize retSize2 = w1.Size();
sl@0
  1362
    TEST(retSize2 == size2);
sl@0
  1363
sl@0
  1364
    // w1 State Final
sl@0
  1365
    CleanupStack::Pop();
sl@0
  1366
    w1.Close();
sl@0
  1367
    
sl@0
  1368
    CleanupStack::Pop();
sl@0
  1369
    wg.Close();
sl@0
  1370
    
sl@0
  1371
    CleanupStack::Pop();
sl@0
  1372
    rws.Close();
sl@0
  1373
sl@0
  1374
    __UHEAP_MARKEND;
sl@0
  1375
    }
sl@0
  1376
sl@0
  1377
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1378
    {
sl@0
  1379
    __UHEAP_MARK;
sl@0
  1380
    // w* State Initial
sl@0
  1381
    RWsSession rws;
sl@0
  1382
    TInt err = rws.Connect();
sl@0
  1383
    CleanupClosePushL(rws);
sl@0
  1384
    TEST(err==KErrNone);
sl@0
  1385
sl@0
  1386
    if (aEnableWindowSizeCache)
sl@0
  1387
        {
sl@0
  1388
        rws.EnableWindowSizeCacheL();
sl@0
  1389
        }
sl@0
  1390
sl@0
  1391
    RWindowGroup wg(rws);
sl@0
  1392
    wg.Construct(0);
sl@0
  1393
    CleanupClosePushL(rws);
sl@0
  1394
sl@0
  1395
    // w1 State 0
sl@0
  1396
    RWindow w1(rws);
sl@0
  1397
    w1.Construct(wg,1);
sl@0
  1398
    CleanupClosePushL(w1);
sl@0
  1399
sl@0
  1400
    // w1 State 0
sl@0
  1401
    TSize size1 (10001,123);
sl@0
  1402
    w1.SetSize(size1);
sl@0
  1403
    rws.Flush();
sl@0
  1404
    
sl@0
  1405
    // w1 State 1
sl@0
  1406
    TSize retSize1 = w1.Size();
sl@0
  1407
    TEST(retSize1 == size1);
sl@0
  1408
    
sl@0
  1409
    // w1 State 2
sl@0
  1410
    TPoint point2 (20202,223);
sl@0
  1411
    TSize size2 (20002,223);
sl@0
  1412
    err = w1.SetExtentErr(point2, size2); 
sl@0
  1413
    TEST(KErrNone == err);
sl@0
  1414
sl@0
  1415
    // w1 State 1
sl@0
  1416
    TSize retSize2 = w1.Size();
sl@0
  1417
    TEST(retSize2 == size2);
sl@0
  1418
sl@0
  1419
    // w1 State Final
sl@0
  1420
    CleanupStack::Pop();
sl@0
  1421
    w1.Close();
sl@0
  1422
    
sl@0
  1423
    CleanupStack::Pop();
sl@0
  1424
    wg.Close();
sl@0
  1425
    
sl@0
  1426
    CleanupStack::Pop();
sl@0
  1427
    rws.Close();
sl@0
  1428
sl@0
  1429
    __UHEAP_MARKEND;
sl@0
  1430
    }
sl@0
  1431
sl@0
  1432
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1433
    {
sl@0
  1434
    __UHEAP_MARK;
sl@0
  1435
    // w* State Initial
sl@0
  1436
    RWsSession rws;
sl@0
  1437
    TInt err = rws.Connect();
sl@0
  1438
    CleanupClosePushL(rws);
sl@0
  1439
    TEST(err==KErrNone);
sl@0
  1440
sl@0
  1441
    if (aEnableWindowSizeCache)
sl@0
  1442
        {
sl@0
  1443
        rws.EnableWindowSizeCacheL();
sl@0
  1444
        }
sl@0
  1445
sl@0
  1446
    RWindowGroup wg(rws);
sl@0
  1447
    wg.Construct(0);
sl@0
  1448
    CleanupClosePushL(rws);
sl@0
  1449
sl@0
  1450
    // w1 State 0
sl@0
  1451
    RWindow w1(rws);
sl@0
  1452
    w1.Construct(wg,1);
sl@0
  1453
    CleanupClosePushL(w1);
sl@0
  1454
sl@0
  1455
    // w1 State 0
sl@0
  1456
    TSize size1 (10001,123);
sl@0
  1457
    w1.SetSize(size1);
sl@0
  1458
    rws.Flush();
sl@0
  1459
    
sl@0
  1460
    // w1 State 1
sl@0
  1461
    TSize retSize1 = w1.Size();
sl@0
  1462
    TEST(retSize1 == size1);
sl@0
  1463
    
sl@0
  1464
    // w1 State 2
sl@0
  1465
    TSize size2 (20002,223);
sl@0
  1466
    w1.SetSize(size2); 
sl@0
  1467
sl@0
  1468
    TSize size3 (30003,323);
sl@0
  1469
    // w1 State 2
sl@0
  1470
    w1.SetSize(size3); 
sl@0
  1471
    rws.Flush();
sl@0
  1472
sl@0
  1473
    // w1 State 1
sl@0
  1474
    TSize retSize2 = w1.Size();
sl@0
  1475
    TEST(retSize2 == size3);
sl@0
  1476
sl@0
  1477
    // w1 State Final
sl@0
  1478
    CleanupStack::Pop();
sl@0
  1479
    w1.Close();
sl@0
  1480
    
sl@0
  1481
    CleanupStack::Pop();
sl@0
  1482
    wg.Close();
sl@0
  1483
    
sl@0
  1484
    CleanupStack::Pop();
sl@0
  1485
    rws.Close();
sl@0
  1486
sl@0
  1487
    __UHEAP_MARKEND;
sl@0
  1488
    }
sl@0
  1489
sl@0
  1490
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1491
    {
sl@0
  1492
    __UHEAP_MARK;
sl@0
  1493
    // w* State Initial
sl@0
  1494
    RWsSession rws;
sl@0
  1495
    TInt err = rws.Connect();
sl@0
  1496
    CleanupClosePushL(rws);
sl@0
  1497
    TEST(err==KErrNone);
sl@0
  1498
sl@0
  1499
    if (aEnableWindowSizeCache)
sl@0
  1500
        {
sl@0
  1501
        rws.EnableWindowSizeCacheL();
sl@0
  1502
        }
sl@0
  1503
sl@0
  1504
    RWindowGroup wg(rws);
sl@0
  1505
    wg.Construct(0);
sl@0
  1506
    CleanupClosePushL(rws);
sl@0
  1507
sl@0
  1508
    // w1 State 0
sl@0
  1509
    RWindow w1(rws);
sl@0
  1510
    w1.Construct(wg,1);
sl@0
  1511
    CleanupClosePushL(w1);
sl@0
  1512
sl@0
  1513
    // w1 State 0
sl@0
  1514
    TSize size1 (10001,123);
sl@0
  1515
    w1.SetSize(size1);
sl@0
  1516
    rws.Flush();
sl@0
  1517
    
sl@0
  1518
    // w1 State 1
sl@0
  1519
    TSize retSize1 = w1.Size();
sl@0
  1520
    TEST(retSize1 == size1);
sl@0
  1521
    
sl@0
  1522
    // w1 State 2
sl@0
  1523
    TSize size2 (20002,223);
sl@0
  1524
    w1.SetSize(size2); 
sl@0
  1525
sl@0
  1526
    // w1 State 2
sl@0
  1527
    TPoint point3 (30303,232);
sl@0
  1528
    TSize size3 (30003,323);
sl@0
  1529
    w1.SetExtent(point3, size3); 
sl@0
  1530
    rws.Flush();
sl@0
  1531
sl@0
  1532
    // w1 State 1
sl@0
  1533
    TSize retSize2 = w1.Size();
sl@0
  1534
    TEST(retSize2 == size3);
sl@0
  1535
sl@0
  1536
    // w1 State Final
sl@0
  1537
    CleanupStack::Pop();
sl@0
  1538
    w1.Close();
sl@0
  1539
    
sl@0
  1540
    CleanupStack::Pop();
sl@0
  1541
    wg.Close();
sl@0
  1542
    
sl@0
  1543
    CleanupStack::Pop();
sl@0
  1544
    rws.Close();
sl@0
  1545
sl@0
  1546
    __UHEAP_MARKEND;
sl@0
  1547
    }
sl@0
  1548
sl@0
  1549
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1550
    {
sl@0
  1551
    __UHEAP_MARK;
sl@0
  1552
    // w* State Initial
sl@0
  1553
    RWsSession rws;
sl@0
  1554
    TInt err = rws.Connect();
sl@0
  1555
    CleanupClosePushL(rws);
sl@0
  1556
    TEST(err==KErrNone);
sl@0
  1557
sl@0
  1558
    if (aEnableWindowSizeCache)
sl@0
  1559
        {
sl@0
  1560
        rws.EnableWindowSizeCacheL();
sl@0
  1561
        }
sl@0
  1562
sl@0
  1563
    RWindowGroup wg(rws);
sl@0
  1564
    wg.Construct(0);
sl@0
  1565
    CleanupClosePushL(rws);
sl@0
  1566
sl@0
  1567
    // w1 State 0
sl@0
  1568
    RWindow w1(rws);
sl@0
  1569
    w1.Construct(wg,1);
sl@0
  1570
    CleanupClosePushL(w1);
sl@0
  1571
sl@0
  1572
    // w1 State 0
sl@0
  1573
    TSize size1 (10001,123);
sl@0
  1574
    w1.SetSize(size1);
sl@0
  1575
    rws.Flush();
sl@0
  1576
    
sl@0
  1577
    // w1 State 1
sl@0
  1578
    TSize retSize1 = w1.Size();
sl@0
  1579
    TEST(retSize1 == size1);
sl@0
  1580
    
sl@0
  1581
    // w1 State 2
sl@0
  1582
    TSize size2 (20002,223);
sl@0
  1583
    w1.SetSize(size2); 
sl@0
  1584
sl@0
  1585
    // w1 State 2
sl@0
  1586
    TSize size3 (30003,323);
sl@0
  1587
    err = w1.SetSizeErr(size3);
sl@0
  1588
    TEST(KErrNone == err);
sl@0
  1589
sl@0
  1590
    // w1 State 1
sl@0
  1591
    TSize retSize2 = w1.Size();
sl@0
  1592
    TEST(retSize2 == size3);
sl@0
  1593
sl@0
  1594
    // w1 State Final
sl@0
  1595
    CleanupStack::Pop();
sl@0
  1596
    w1.Close();
sl@0
  1597
    
sl@0
  1598
    CleanupStack::Pop();
sl@0
  1599
    wg.Close();
sl@0
  1600
    
sl@0
  1601
    CleanupStack::Pop();
sl@0
  1602
    rws.Close();
sl@0
  1603
sl@0
  1604
    __UHEAP_MARKEND;
sl@0
  1605
    }
sl@0
  1606
sl@0
  1607
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1608
    {
sl@0
  1609
    __UHEAP_MARK;
sl@0
  1610
    // w* State Initial
sl@0
  1611
    RWsSession rws;
sl@0
  1612
    TInt err = rws.Connect();
sl@0
  1613
    CleanupClosePushL(rws);
sl@0
  1614
    TEST(err==KErrNone);
sl@0
  1615
sl@0
  1616
    if (aEnableWindowSizeCache)
sl@0
  1617
        {
sl@0
  1618
        rws.EnableWindowSizeCacheL();
sl@0
  1619
        }
sl@0
  1620
sl@0
  1621
    RWindowGroup wg(rws);
sl@0
  1622
    wg.Construct(0);
sl@0
  1623
    CleanupClosePushL(rws);
sl@0
  1624
sl@0
  1625
    // w1 State 0
sl@0
  1626
    RWindow w1(rws);
sl@0
  1627
    w1.Construct(wg,1);
sl@0
  1628
    CleanupClosePushL(w1);
sl@0
  1629
sl@0
  1630
    // w1 State 0
sl@0
  1631
    TSize size1 (10001,123);
sl@0
  1632
    w1.SetSize(size1);
sl@0
  1633
    rws.Flush();
sl@0
  1634
    
sl@0
  1635
    // w1 State 1
sl@0
  1636
    TSize retSize1 = w1.Size();
sl@0
  1637
    TEST(retSize1 == size1);
sl@0
  1638
    
sl@0
  1639
    // w1 State 2
sl@0
  1640
    TSize size2 (20002,223);
sl@0
  1641
    w1.SetSize(size2); 
sl@0
  1642
sl@0
  1643
    // w1 State 2
sl@0
  1644
    TPoint point3 (30303,232);
sl@0
  1645
    TSize size3 (30003,323);
sl@0
  1646
    err = w1.SetExtentErr(point3, size3); 
sl@0
  1647
    TEST(KErrNone == err);
sl@0
  1648
sl@0
  1649
    // w1 State 1
sl@0
  1650
    TSize retSize2 = w1.Size();
sl@0
  1651
    TEST(retSize2 == size3);
sl@0
  1652
sl@0
  1653
    // w1 State Final
sl@0
  1654
    CleanupStack::Pop();
sl@0
  1655
    w1.Close();
sl@0
  1656
    
sl@0
  1657
    CleanupStack::Pop();
sl@0
  1658
    wg.Close();
sl@0
  1659
    
sl@0
  1660
    CleanupStack::Pop();
sl@0
  1661
    rws.Close();
sl@0
  1662
sl@0
  1663
    __UHEAP_MARKEND;
sl@0
  1664
    }
sl@0
  1665
sl@0
  1666
void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL()
sl@0
  1667
    {
sl@0
  1668
    __UHEAP_MARK;
sl@0
  1669
    // w* State Initial
sl@0
  1670
    RWsSession rws;
sl@0
  1671
    TInt err = rws.Connect();
sl@0
  1672
    CleanupClosePushL(rws);
sl@0
  1673
    TEST(err==KErrNone);
sl@0
  1674
sl@0
  1675
    rws.EnableWindowSizeCacheL();
sl@0
  1676
sl@0
  1677
    RWindowGroup wg(rws);
sl@0
  1678
    wg.Construct(0);
sl@0
  1679
    CleanupClosePushL(rws);
sl@0
  1680
sl@0
  1681
    // w1 State 0
sl@0
  1682
    RWindow w1(rws);
sl@0
  1683
    w1.Construct(wg,1);
sl@0
  1684
    CleanupClosePushL(w1);
sl@0
  1685
sl@0
  1686
    // w1 State 0
sl@0
  1687
    TSize size1 (10001,123);
sl@0
  1688
    w1.SetSize(size1);
sl@0
  1689
    rws.Flush();
sl@0
  1690
    
sl@0
  1691
    // w1 State 1
sl@0
  1692
    TSize retSize1 = w1.Size();
sl@0
  1693
    TEST(retSize1 == size1);
sl@0
  1694
    
sl@0
  1695
    // w1 State 2
sl@0
  1696
    TSize size2 (20002,223);
sl@0
  1697
    w1.SetSize(size2); 
sl@0
  1698
sl@0
  1699
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
  1700
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
  1701
    rws.EnableWindowSizeCacheL();
sl@0
  1702
sl@0
  1703
    // w1 State 1
sl@0
  1704
    TSize retSize2 = w1.Size();
sl@0
  1705
    TEST(retSize2 == size2);
sl@0
  1706
sl@0
  1707
    // w1 State Final
sl@0
  1708
    CleanupStack::Pop();
sl@0
  1709
    w1.Close();
sl@0
  1710
    
sl@0
  1711
    CleanupStack::Pop();
sl@0
  1712
    wg.Close();
sl@0
  1713
    
sl@0
  1714
    CleanupStack::Pop();
sl@0
  1715
    rws.Close();
sl@0
  1716
sl@0
  1717
    __UHEAP_MARKEND;
sl@0
  1718
    }
sl@0
  1719
sl@0
  1720
//------------------------------------------------------------------------------------------
sl@0
  1721
sl@0
  1722
void CTWindowSizeCacheTest::TestRBlankWindowSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1723
    {
sl@0
  1724
    __UHEAP_MARK;
sl@0
  1725
    // w* State Initial
sl@0
  1726
    RWsSession rws;
sl@0
  1727
    TInt err = rws.Connect();
sl@0
  1728
    CleanupClosePushL(rws);
sl@0
  1729
    TEST(err==KErrNone);
sl@0
  1730
sl@0
  1731
    if (aEnableWindowSizeCache)
sl@0
  1732
        {
sl@0
  1733
        rws.EnableWindowSizeCacheL();
sl@0
  1734
        }
sl@0
  1735
sl@0
  1736
    RWindowGroup wg(rws);
sl@0
  1737
    err = wg.Construct(0);
sl@0
  1738
    CleanupClosePushL(rws);
sl@0
  1739
    TEST(err==KErrNone);
sl@0
  1740
sl@0
  1741
    // w1 State 0
sl@0
  1742
    RBlankWindow w1(rws);
sl@0
  1743
    err = w1.Construct(wg,1);
sl@0
  1744
    CleanupClosePushL(w1);
sl@0
  1745
    TEST(err==KErrNone);
sl@0
  1746
sl@0
  1747
    // w1 State 0
sl@0
  1748
    TSize size1 (10001,123);
sl@0
  1749
    w1.SetSize(size1);
sl@0
  1750
    rws.Flush();
sl@0
  1751
    
sl@0
  1752
    // w1 State 1
sl@0
  1753
    TSize retSize1 = w1.Size();
sl@0
  1754
    TEST(retSize1 == size1);
sl@0
  1755
    
sl@0
  1756
    // w1 State 2
sl@0
  1757
    TSize size2 (20002,223);
sl@0
  1758
    w1.SetSize(size2); 
sl@0
  1759
sl@0
  1760
    // w1 State 2
sl@0
  1761
    TPoint point3 (30303,232);
sl@0
  1762
    TSize size3 (30003,323);
sl@0
  1763
    w1.SetExtent(point3, size3);
sl@0
  1764
    rws.Flush();
sl@0
  1765
sl@0
  1766
    // w1 State 1
sl@0
  1767
    TSize retSize2 = w1.Size();
sl@0
  1768
    TEST(retSize2 == size3);
sl@0
  1769
sl@0
  1770
    // w1 State 2
sl@0
  1771
    TSize size4 (40004,423);
sl@0
  1772
    w1.SetSize(size4);
sl@0
  1773
    
sl@0
  1774
    // w1 State 1
sl@0
  1775
    TSize retSize3 = w1.Size();
sl@0
  1776
    TEST(retSize3 == size4);
sl@0
  1777
sl@0
  1778
    // w1 State Final
sl@0
  1779
    CleanupStack::Pop();
sl@0
  1780
    w1.Close();
sl@0
  1781
    
sl@0
  1782
    CleanupStack::Pop();
sl@0
  1783
    wg.Close();
sl@0
  1784
    
sl@0
  1785
    CleanupStack::Pop();
sl@0
  1786
    rws.Close();
sl@0
  1787
sl@0
  1788
    __UHEAP_MARKEND;
sl@0
  1789
    }
sl@0
  1790
sl@0
  1791
//------------------------------------------------------------------------------------------
sl@0
  1792
sl@0
  1793
void CTWindowSizeCacheTest::TestRBackedUpWindowSetSizeErrSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache)
sl@0
  1794
    {
sl@0
  1795
    __UHEAP_MARK;
sl@0
  1796
    // w* State Initial
sl@0
  1797
    RWsSession rws;
sl@0
  1798
    TInt err = rws.Connect();
sl@0
  1799
    CleanupClosePushL(rws);
sl@0
  1800
    TEST(err==KErrNone);
sl@0
  1801
sl@0
  1802
    if (aEnableWindowSizeCache)
sl@0
  1803
        {
sl@0
  1804
        rws.EnableWindowSizeCacheL();
sl@0
  1805
        }
sl@0
  1806
sl@0
  1807
    RWindowGroup wg(rws);
sl@0
  1808
    err = wg.Construct(0);
sl@0
  1809
    CleanupClosePushL(rws);
sl@0
  1810
    TEST(err==KErrNone);
sl@0
  1811
sl@0
  1812
    // w1 State 0
sl@0
  1813
    RBlankWindow w1(rws);
sl@0
  1814
    err = w1.Construct(wg,1);
sl@0
  1815
    CleanupClosePushL(w1);
sl@0
  1816
    TEST(err==KErrNone);
sl@0
  1817
sl@0
  1818
    // w1 State 0
sl@0
  1819
    TSize size1 (10001,123);
sl@0
  1820
    err = w1.SetSizeErr(size1);
sl@0
  1821
    TEST(err==KErrNone);
sl@0
  1822
    
sl@0
  1823
    // w1 State 1
sl@0
  1824
    TSize retSize1 = w1.Size();
sl@0
  1825
    TEST(retSize1 == size1);
sl@0
  1826
    
sl@0
  1827
    // w1 State 2
sl@0
  1828
    TSize size2 (20002,223);
sl@0
  1829
    err = w1.SetSizeErr(size2); 
sl@0
  1830
    TEST(err==KErrNone);
sl@0
  1831
sl@0
  1832
    // w1 State 2
sl@0
  1833
    TPoint point3 (30303,232);
sl@0
  1834
    TSize size3 (30003,323);
sl@0
  1835
    err = w1.SetExtentErr(point3, size3);
sl@0
  1836
    TEST(err==KErrNone);
sl@0
  1837
sl@0
  1838
    // w1 State 1
sl@0
  1839
    TSize retSize2 = w1.Size();
sl@0
  1840
    TEST(retSize2 == size3);
sl@0
  1841
sl@0
  1842
    // w1 State 2
sl@0
  1843
    TSize size4 (40004,423);
sl@0
  1844
    err = w1.SetSizeErr(size4);
sl@0
  1845
    TEST(err==KErrNone);
sl@0
  1846
    
sl@0
  1847
    // w1 State 1
sl@0
  1848
    TSize retSize3 = w1.Size();
sl@0
  1849
    TEST(retSize3 == size4);
sl@0
  1850
sl@0
  1851
    // w1 State Final
sl@0
  1852
    CleanupStack::Pop();
sl@0
  1853
    w1.Close();
sl@0
  1854
    
sl@0
  1855
    CleanupStack::Pop();
sl@0
  1856
    wg.Close();
sl@0
  1857
    
sl@0
  1858
    CleanupStack::Pop();
sl@0
  1859
    rws.Close();
sl@0
  1860
sl@0
  1861
    __UHEAP_MARKEND;
sl@0
  1862
    }
sl@0
  1863
sl@0
  1864
//------------------------------------------------------------------------------------------
sl@0
  1865
sl@0
  1866
TUint64 CTWindowSizeCacheTest::TestRWindowSizePerformanceL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations)
sl@0
  1867
    {
sl@0
  1868
    TUint64 timeDeltaMicroSeconds = 0;
sl@0
  1869
    
sl@0
  1870
    __UHEAP_MARK;
sl@0
  1871
    // w* State Initial
sl@0
  1872
    RWsSession rws;
sl@0
  1873
    TInt err = rws.Connect();
sl@0
  1874
    TEST(KErrNone == err);
sl@0
  1875
    CleanupClosePushL(rws);
sl@0
  1876
sl@0
  1877
    if (ETestSizeCacheEnabled == aEnableWindowSizeCache)
sl@0
  1878
        {
sl@0
  1879
        rws.EnableWindowSizeCacheL();
sl@0
  1880
        }
sl@0
  1881
sl@0
  1882
    RWindowGroup wg(rws);
sl@0
  1883
    err = wg.Construct(0);
sl@0
  1884
    TEST(KErrNone == err);
sl@0
  1885
    CleanupClosePushL(wg);
sl@0
  1886
sl@0
  1887
    // w1 State 0
sl@0
  1888
    RWindow w1(rws);
sl@0
  1889
    err = w1.Construct(wg,1);
sl@0
  1890
    TEST(KErrNone == err);
sl@0
  1891
    CleanupClosePushL(w1);
sl@0
  1892
    
sl@0
  1893
    TSize size1 (10001,123);
sl@0
  1894
    w1.SetSize(size1);
sl@0
  1895
sl@0
  1896
    TTime start;
sl@0
  1897
    TTime end;
sl@0
  1898
    start.UniversalTime();
sl@0
  1899
    for (TUint iter = 0; iter < aIterations; ++iter)
sl@0
  1900
        {
sl@0
  1901
        // w1 State 1
sl@0
  1902
        TSize retSize1 = w1.Size();
sl@0
  1903
        TEST(retSize1 == size1);
sl@0
  1904
        }
sl@0
  1905
    end.UniversalTime();
sl@0
  1906
sl@0
  1907
    TTimeIntervalMicroSeconds delta = end.MicroSecondsFrom(start);
sl@0
  1908
    timeDeltaMicroSeconds = delta.Int64();
sl@0
  1909
    INFO_PRINTF4(_L("TestRWindowSizePerformanceL - WindowSizeCacheEnabled %d, Iterations %d, Microseconds %Ld"), aEnableWindowSizeCache, aIterations, timeDeltaMicroSeconds);
sl@0
  1910
    
sl@0
  1911
    // w1 State Final
sl@0
  1912
    CleanupStack::Pop();
sl@0
  1913
    w1.Close();
sl@0
  1914
sl@0
  1915
    CleanupStack::Pop();
sl@0
  1916
    wg.Close();
sl@0
  1917
sl@0
  1918
    CleanupStack::Pop();
sl@0
  1919
    rws.Close();
sl@0
  1920
sl@0
  1921
    __UHEAP_MARKEND;
sl@0
  1922
    return timeDeltaMicroSeconds;
sl@0
  1923
    }
sl@0
  1924
sl@0
  1925
sl@0
  1926
//------------------------------------------------------------------------------------------
sl@0
  1927
/*
sl@0
  1928
Sets the random seed used by CTWindowSizeCacheTest::NextRandom.
sl@0
  1929
 */
sl@0
  1930
void CTWindowSizeCacheTest::SetRandomSeed(TInt64 aSeed)
sl@0
  1931
    {
sl@0
  1932
    INFO_PRINTF2(_L("Random Seed - %d"), aSeed);
sl@0
  1933
    iSeed = aSeed;
sl@0
  1934
    }
sl@0
  1935
sl@0
  1936
/*
sl@0
  1937
Performs an action on RWindow or RWsSession as specified by TRWindowAction aAction.
sl@0
  1938
When the size of the window is changed, aExpectedSize is changed to the size we expect the window to be the next time RWindow::Size is called.
sl@0
  1939
When RWindow::Size is called, we check the size returned matches aExpectedSize.
sl@0
  1940
If aAction requests RWsSession::EnableWindowSizeCache, we call this if TSizeCacheStatus allows this.
sl@0
  1941
sl@0
  1942
This function was designed for use with random stress tests, with a pseudo-random sequence driving TRWindowAction.  
sl@0
  1943
 */
sl@0
  1944
void CTWindowSizeCacheTest::RWindowPerformAction(TRWindowAction aAction, TSizeCacheStatus aEnableWindowSizeCache, RWsSession& aWs, RWindow& aWindow, TSize& aExpectedSize)
sl@0
  1945
    {
sl@0
  1946
    switch (aAction)
sl@0
  1947
        {
sl@0
  1948
        case ESetExtent :
sl@0
  1949
            {
sl@0
  1950
            TPoint point(NextRandom(), NextRandom());
sl@0
  1951
            aExpectedSize.iHeight = NextRandom();
sl@0
  1952
            aExpectedSize.iWidth = NextRandom();
sl@0
  1953
            aWindow.SetExtent(point, aExpectedSize);
sl@0
  1954
            aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight;
sl@0
  1955
            aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth;
sl@0
  1956
            }
sl@0
  1957
            break;
sl@0
  1958
        case ESetExtentErr :
sl@0
  1959
            {
sl@0
  1960
            TPoint point(NextRandom(), NextRandom());
sl@0
  1961
            aExpectedSize.iHeight = NextRandom();
sl@0
  1962
            aExpectedSize.iWidth = NextRandom();
sl@0
  1963
            TInt err = aWindow.SetExtentErr(point, aExpectedSize);
sl@0
  1964
            TEST(KErrNone == err);
sl@0
  1965
            aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight;
sl@0
  1966
            aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth;
sl@0
  1967
            }
sl@0
  1968
            break;
sl@0
  1969
        case ESetSize :
sl@0
  1970
            {
sl@0
  1971
            aExpectedSize.iHeight = NextRandom();
sl@0
  1972
            aExpectedSize.iWidth = NextRandom();
sl@0
  1973
            aWindow.SetSize(aExpectedSize);
sl@0
  1974
            aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight;
sl@0
  1975
            aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth;
sl@0
  1976
            }
sl@0
  1977
            break;
sl@0
  1978
        case ESetSizeErr :
sl@0
  1979
            {
sl@0
  1980
            aExpectedSize.iHeight = NextRandom();
sl@0
  1981
            aExpectedSize.iWidth = NextRandom();
sl@0
  1982
            TInt err = aWindow.SetSizeErr(aExpectedSize);
sl@0
  1983
            TEST(KErrNone == err);
sl@0
  1984
            aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight;
sl@0
  1985
            aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth;
sl@0
  1986
            }
sl@0
  1987
            break;
sl@0
  1988
        case ECheckSize :
sl@0
  1989
            {
sl@0
  1990
            TSize retSize1 = aWindow.Size();
sl@0
  1991
            TEST(retSize1 == aExpectedSize);
sl@0
  1992
            }
sl@0
  1993
            break;
sl@0
  1994
        case EFlushSession :
sl@0
  1995
            {
sl@0
  1996
            aWs.Flush();
sl@0
  1997
            }
sl@0
  1998
            break;
sl@0
  1999
        case EEnableWindowSizeCache :
sl@0
  2000
            {
sl@0
  2001
            if (ETestSizeCacheEnabled == aEnableWindowSizeCache)
sl@0
  2002
                {
sl@0
  2003
                aWs.EnableWindowSizeCacheL();
sl@0
  2004
                }
sl@0
  2005
            }
sl@0
  2006
            break;
sl@0
  2007
        default :
sl@0
  2008
            break;
sl@0
  2009
        }
sl@0
  2010
    }
sl@0
  2011
sl@0
  2012
void CTWindowSizeCacheTest::TestRandomisedStressL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations)
sl@0
  2013
    {
sl@0
  2014
    __UHEAP_MARK;
sl@0
  2015
    // w* State Initial
sl@0
  2016
    RWsSession rws;
sl@0
  2017
    TInt err = rws.Connect();
sl@0
  2018
    TEST(KErrNone == err);
sl@0
  2019
    CleanupClosePushL(rws);
sl@0
  2020
sl@0
  2021
    if (aEnableWindowSizeCache)
sl@0
  2022
        {
sl@0
  2023
        rws.EnableWindowSizeCacheL();
sl@0
  2024
        }
sl@0
  2025
sl@0
  2026
    RWindowGroup wg(rws);
sl@0
  2027
    err = wg.Construct(0);
sl@0
  2028
    TEST(KErrNone == err);
sl@0
  2029
    CleanupClosePushL(wg);
sl@0
  2030
sl@0
  2031
    // w1 State 0
sl@0
  2032
    RWindow w1(rws);
sl@0
  2033
    err = w1.Construct(wg,1);
sl@0
  2034
    TEST(KErrNone == err);
sl@0
  2035
    CleanupClosePushL(w1);
sl@0
  2036
    
sl@0
  2037
    TSize size1 (10001,123);
sl@0
  2038
    w1.SetSize(size1);
sl@0
  2039
sl@0
  2040
    for (TUint iter = 0; iter < aIterations; ++iter)
sl@0
  2041
        {
sl@0
  2042
        TRWindowAction action = static_cast<TRWindowAction>(NextRandom(EMaxAction));
sl@0
  2043
        RWindowPerformAction(action, aEnableWindowSizeCache, rws, w1, size1);
sl@0
  2044
        }
sl@0
  2045
    
sl@0
  2046
    // w1 State Final
sl@0
  2047
    CleanupStack::Pop();
sl@0
  2048
    w1.Close();
sl@0
  2049
    
sl@0
  2050
    CleanupStack::Pop();
sl@0
  2051
    wg.Close();
sl@0
  2052
sl@0
  2053
    CleanupStack::Pop();
sl@0
  2054
    rws.Close();
sl@0
  2055
    __UHEAP_MARKEND;
sl@0
  2056
    }
sl@0
  2057
sl@0
  2058
/*
sl@0
  2059
TCleanupOperation for a window pool, implemented as RPointerArray<RWindow>.
sl@0
  2060
 */
sl@0
  2061
void CTWindowSizeCacheTest::CleanupWindowPool(TAny* aPtr)
sl@0
  2062
    {
sl@0
  2063
    RPointerArray<RWindow> windowPool = *(static_cast<RPointerArray<RWindow>*>(aPtr));
sl@0
  2064
    const TUint poolSize = windowPool.Count();
sl@0
  2065
    // Note: ResetAndDestroy deletes referenced objects, so no need to delete items in loop
sl@0
  2066
    for (TUint iter = 0; iter < poolSize; ++iter)
sl@0
  2067
        {
sl@0
  2068
        windowPool[iter]->Close();
sl@0
  2069
        }
sl@0
  2070
    windowPool.ResetAndDestroy();
sl@0
  2071
    }
sl@0
  2072
sl@0
  2073
void CTWindowSizeCacheTest::TestRandomisedStressMultiSessionL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations)
sl@0
  2074
    {
sl@0
  2075
    __UHEAP_MARK;
sl@0
  2076
    // w* State Initial
sl@0
  2077
    RWsSession rws1;
sl@0
  2078
    TInt err = rws1.Connect();
sl@0
  2079
    TEST(KErrNone == err);
sl@0
  2080
    CleanupClosePushL(rws1);
sl@0
  2081
sl@0
  2082
    // Multiple sessions in one thread
sl@0
  2083
    RWsSession rws2;
sl@0
  2084
    err = rws2.Connect();
sl@0
  2085
    TEST(KErrNone == err);
sl@0
  2086
    CleanupClosePushL(rws2);
sl@0
  2087
    
sl@0
  2088
    RWindowGroup rws1_wg1(rws1);
sl@0
  2089
    err = rws1_wg1.Construct(0);
sl@0
  2090
    CleanupClosePushL(rws1_wg1);
sl@0
  2091
    TEST(KErrNone == err);
sl@0
  2092
sl@0
  2093
    RWindowGroup rws2_wg1(rws2);
sl@0
  2094
    err = rws2_wg1.Construct(0);
sl@0
  2095
    CleanupClosePushL(rws2_wg1);
sl@0
  2096
    TEST(KErrNone == err);
sl@0
  2097
sl@0
  2098
    // Multiple window groups in one session
sl@0
  2099
    RWindowGroup rws2_wg2(rws2);
sl@0
  2100
    err = rws2_wg2.Construct(1);
sl@0
  2101
    CleanupClosePushL(rws2_wg2);
sl@0
  2102
    TEST(KErrNone == err);
sl@0
  2103
    
sl@0
  2104
    // Window pool for all windows owned by session rws1
sl@0
  2105
    RPointerArray<RWindow> rws1_windowPool;
sl@0
  2106
    CleanupStack::PushL(TCleanupItem(CleanupWindowPool,&rws1_windowPool));
sl@0
  2107
    // Each window in window pool has a corresponding expected size at corresponding array index
sl@0
  2108
    RArray<TSize> rws1_expectedSizePool;
sl@0
  2109
    CleanupClosePushL(rws1_expectedSizePool);
sl@0
  2110
sl@0
  2111
    // Window pool for all windows owned by session rws2
sl@0
  2112
    RPointerArray<RWindow> rws2_windowPool;
sl@0
  2113
    CleanupStack::PushL(TCleanupItem(CleanupWindowPool,&rws2_windowPool));
sl@0
  2114
    // Each window in window pool has a corresponding expected size at corresponding array index
sl@0
  2115
    RArray<TSize> rws2_expectedSizePool;
sl@0
  2116
    CleanupClosePushL(rws2_expectedSizePool);
sl@0
  2117
    
sl@0
  2118
    // Populate window pool
sl@0
  2119
    const TUint KWindowCount_rws1_wg1 = 50;
sl@0
  2120
    const TUint KWindowCount_rws2_wg1 = 50;
sl@0
  2121
    const TUint KWindowCount_rws2_wg2 = 50;
sl@0
  2122
    
sl@0
  2123
    // Windows for session 1 belonging to rws1_wg1
sl@0
  2124
    // Many windows - siblings
sl@0
  2125
    for (TUint iter = 0; iter < KWindowCount_rws1_wg1; ++iter)
sl@0
  2126
        {
sl@0
  2127
        RWindow* win = new (ELeave) RWindow(rws1);
sl@0
  2128
        CleanupStack::PushL(win);
sl@0
  2129
        TInt err = win->Construct(rws1_wg1,iter+1);
sl@0
  2130
        TEST(KErrNone == err);
sl@0
  2131
        rws1_windowPool.AppendL(win);
sl@0
  2132
        CleanupStack::Pop(win);
sl@0
  2133
        TSize expectedSize (NextRandom(),NextRandom());
sl@0
  2134
        win->SetSize(expectedSize);
sl@0
  2135
        // Wserv flattens size to zero
sl@0
  2136
        expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight;
sl@0
  2137
        expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth;
sl@0
  2138
        rws1_expectedSizePool.AppendL(expectedSize);
sl@0
  2139
        TSize retSize1 = win->Size();
sl@0
  2140
        TEST(retSize1 == expectedSize);
sl@0
  2141
        }
sl@0
  2142
sl@0
  2143
    // Windows for session 2 belonging to rws2_wg1
sl@0
  2144
    // Many windows - siblings
sl@0
  2145
    for (TUint iter = 0; iter < KWindowCount_rws2_wg1; ++iter)
sl@0
  2146
        {
sl@0
  2147
        RWindow* win = new (ELeave) RWindow(rws2);
sl@0
  2148
        CleanupStack::PushL(win);
sl@0
  2149
        TInt err = win->Construct(rws2_wg1,iter+2);
sl@0
  2150
        TEST(KErrNone == err);
sl@0
  2151
        rws2_windowPool.AppendL(win);
sl@0
  2152
        CleanupStack::Pop();
sl@0
  2153
        TSize expectedSize (NextRandom(),NextRandom());
sl@0
  2154
        win->SetSize(expectedSize);
sl@0
  2155
        // Wserv flattens size to zero
sl@0
  2156
        expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight;
sl@0
  2157
        expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth;
sl@0
  2158
        rws2_expectedSizePool.AppendL(expectedSize);
sl@0
  2159
        TSize retSize1 = win->Size();
sl@0
  2160
        TEST(retSize1 == expectedSize);
sl@0
  2161
        }
sl@0
  2162
    
sl@0
  2163
    // Windows for session 2 belonging to rws2_wg2
sl@0
  2164
    // Many windows - children
sl@0
  2165
    RWindowTreeNode parent = rws2_wg2; 
sl@0
  2166
    for (TUint iter = 0; iter < KWindowCount_rws2_wg2; ++iter)
sl@0
  2167
        {
sl@0
  2168
        RWindow* win = new (ELeave) RWindow(rws2);
sl@0
  2169
        CleanupStack::PushL(win);
sl@0
  2170
        TInt err = win->Construct(parent,KWindowCount_rws2_wg1+iter+2);
sl@0
  2171
        TEST(KErrNone == err);
sl@0
  2172
        parent = *win;
sl@0
  2173
        rws2_windowPool.AppendL(win);
sl@0
  2174
        CleanupStack::Pop();
sl@0
  2175
        TSize expectedSize (NextRandom(),NextRandom());
sl@0
  2176
        win->SetSize(expectedSize);
sl@0
  2177
        // Wserv flattens size to zero
sl@0
  2178
        expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight;
sl@0
  2179
        expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth;
sl@0
  2180
        rws2_expectedSizePool.AppendL(expectedSize);
sl@0
  2181
        TSize retSize1 = win->Size();
sl@0
  2182
        TEST(retSize1 == expectedSize);
sl@0
  2183
        }
sl@0
  2184
sl@0
  2185
    // Stress system by performing actions on windows
sl@0
  2186
    for (TUint iter = 0; iter < aIterations; ++iter)
sl@0
  2187
        {
sl@0
  2188
        TRWindowAction action = static_cast<TRWindowAction>(NextRandom(EMaxAction));
sl@0
  2189
        TUint32 windowPool = NextRandom(2);
sl@0
  2190
        switch (windowPool)
sl@0
  2191
            {
sl@0
  2192
            case 0 :
sl@0
  2193
                {
sl@0
  2194
                TUint32 target = NextRandom(rws1_windowPool.Count());
sl@0
  2195
                RWindowPerformAction(action, aEnableWindowSizeCache, rws1, *(rws1_windowPool[target]) , rws1_expectedSizePool[target]);
sl@0
  2196
                }
sl@0
  2197
                break;
sl@0
  2198
            case 1 :
sl@0
  2199
                {
sl@0
  2200
                TUint32 target = NextRandom(rws2_windowPool.Count());
sl@0
  2201
                RWindowPerformAction(action, aEnableWindowSizeCache, rws2, *(rws2_windowPool[target]) , rws2_expectedSizePool[target]);
sl@0
  2202
                }
sl@0
  2203
                break;
sl@0
  2204
            default :
sl@0
  2205
                User::Invariant();
sl@0
  2206
            }
sl@0
  2207
        }
sl@0
  2208
     
sl@0
  2209
sl@0
  2210
    // Cleanup afterwards
sl@0
  2211
    CleanupStack::Pop(9);
sl@0
  2212
sl@0
  2213
    CleanupWindowPool(&rws1_windowPool);
sl@0
  2214
    rws1_expectedSizePool.Close();
sl@0
  2215
    rws1_wg1.Close();
sl@0
  2216
    rws1.Close();
sl@0
  2217
sl@0
  2218
    CleanupWindowPool(&rws2_windowPool);
sl@0
  2219
    rws2_expectedSizePool.Close();
sl@0
  2220
    rws2_wg1.Close();
sl@0
  2221
    rws2_wg2.Close();
sl@0
  2222
    rws2.Close();
sl@0
  2223
    }
sl@0
  2224
sl@0
  2225
void CTWindowSizeCacheTest::TestRandomisedStressCacheEntryVolumeL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations, TUint aWindowPoolSize)
sl@0
  2226
    {
sl@0
  2227
    __UHEAP_MARK;
sl@0
  2228
    // w* State Initial
sl@0
  2229
    RWsSession rws1;
sl@0
  2230
    TInt err = rws1.Connect();
sl@0
  2231
    TEST(KErrNone == err);
sl@0
  2232
    CleanupClosePushL(rws1);
sl@0
  2233
sl@0
  2234
    if (aEnableWindowSizeCache)
sl@0
  2235
        {
sl@0
  2236
        rws1.EnableWindowSizeCacheL();
sl@0
  2237
        }
sl@0
  2238
  
sl@0
  2239
    RWindowGroup rws1_wg1(rws1);
sl@0
  2240
    err = rws1_wg1.Construct(0);
sl@0
  2241
    TEST(KErrNone == err);
sl@0
  2242
    CleanupClosePushL(rws1_wg1);
sl@0
  2243
    
sl@0
  2244
    RPointerArray<RWindow> windowPool;
sl@0
  2245
    CleanupStack::PushL(TCleanupItem(CleanupWindowPool,&windowPool));
sl@0
  2246
    // Each window in window pool has a corresponding expected size at corresponding array index
sl@0
  2247
    RArray<TSize> expectedSizePool;
sl@0
  2248
    CleanupClosePushL(expectedSizePool);
sl@0
  2249
    
sl@0
  2250
    // Populate window pool
sl@0
  2251
    for (TUint iter = 0; iter < aWindowPoolSize; ++iter)
sl@0
  2252
        {
sl@0
  2253
        RWindow* win = new (ELeave) RWindow(rws1);
sl@0
  2254
        CleanupStack::PushL(win);
sl@0
  2255
        TInt err = win->Construct(rws1_wg1,iter+1);
sl@0
  2256
        TEST(KErrNone == err);
sl@0
  2257
        windowPool.AppendL(win);
sl@0
  2258
        CleanupStack::Pop(win);
sl@0
  2259
        
sl@0
  2260
        TSize expectedSize (NextRandom(),NextRandom());
sl@0
  2261
        win->SetSize(expectedSize);
sl@0
  2262
        // Wserv flattens size to zero
sl@0
  2263
        expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight;
sl@0
  2264
        expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth;
sl@0
  2265
        expectedSizePool.AppendL(expectedSize);
sl@0
  2266
        TSize retSize1 = win->Size();
sl@0
  2267
        TEST(retSize1 == expectedSize);
sl@0
  2268
        }
sl@0
  2269
sl@0
  2270
    // Stress system by performing actions on windows
sl@0
  2271
    for (TUint iter = 0; iter < aIterations; ++iter)
sl@0
  2272
        {
sl@0
  2273
        TRWindowAction action = static_cast<TRWindowAction>(NextRandom(EMaxAction));
sl@0
  2274
        TUint32 target = NextRandom(aWindowPoolSize);
sl@0
  2275
        RWindowPerformAction(action, aEnableWindowSizeCache, rws1, *(windowPool[target]), expectedSizePool[target]);
sl@0
  2276
        }
sl@0
  2277
sl@0
  2278
    // Cleanup afterwards
sl@0
  2279
    CleanupStack::Pop(4);
sl@0
  2280
sl@0
  2281
    CleanupWindowPool(&windowPool);
sl@0
  2282
    expectedSizePool.Close();
sl@0
  2283
    rws1_wg1.Close();
sl@0
  2284
    rws1.Close();
sl@0
  2285
    
sl@0
  2286
    __UHEAP_MARKEND;
sl@0
  2287
    }
sl@0
  2288
sl@0
  2289
//------------------------------------------------------------------------------------------
sl@0
  2290
sl@0
  2291
void CTWindowSizeCacheTest::TestStressEnableWindowSizeCacheL(TUint aIterations)
sl@0
  2292
    {
sl@0
  2293
    __UHEAP_MARK;
sl@0
  2294
    // w* State Initial
sl@0
  2295
    RWsSession rws;
sl@0
  2296
    TInt err = rws.Connect();
sl@0
  2297
    CleanupClosePushL(rws);
sl@0
  2298
    TEST(err==KErrNone);
sl@0
  2299
sl@0
  2300
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
  2301
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
  2302
    for (TUint iter = 0; iter < aIterations; iter++)
sl@0
  2303
        {
sl@0
  2304
        rws.EnableWindowSizeCacheL();
sl@0
  2305
        }
sl@0
  2306
sl@0
  2307
    RWindowGroup wg(rws);
sl@0
  2308
    wg.Construct(0);
sl@0
  2309
    CleanupClosePushL(rws);
sl@0
  2310
sl@0
  2311
    // w1 State 0
sl@0
  2312
    RWindow w1(rws);
sl@0
  2313
    w1.Construct(wg,1);
sl@0
  2314
    CleanupClosePushL(w1);
sl@0
  2315
    
sl@0
  2316
    TSize size1 (10001,123);
sl@0
  2317
    w1.SetSize(size1);
sl@0
  2318
sl@0
  2319
    // w1 State 1
sl@0
  2320
    TSize retSize1 = w1.Size();
sl@0
  2321
    TEST(retSize1 == size1);
sl@0
  2322
sl@0
  2323
    // w1 State 2
sl@0
  2324
    TSize size2 (20002,223);
sl@0
  2325
    w1.SetSize(size2); 
sl@0
  2326
sl@0
  2327
    // w1 State 2
sl@0
  2328
    // Only the first call to EnableWindowSizeCacheL() should have an effect
sl@0
  2329
    // All subsequent calls to EnableWindowSizeCacheL() should have no effect
sl@0
  2330
    for (TUint iter = 0; iter < aIterations; iter++)
sl@0
  2331
        {
sl@0
  2332
        rws.EnableWindowSizeCacheL();
sl@0
  2333
        }
sl@0
  2334
   
sl@0
  2335
    // w1 State 1
sl@0
  2336
    TSize retSize2 = w1.Size();
sl@0
  2337
    TEST(retSize2 == size2);
sl@0
  2338
sl@0
  2339
    // w1 State Final
sl@0
  2340
    CleanupStack::Pop();
sl@0
  2341
    w1.Close();
sl@0
  2342
    
sl@0
  2343
    CleanupStack::Pop();
sl@0
  2344
    wg.Close();
sl@0
  2345
    
sl@0
  2346
    CleanupStack::Pop();
sl@0
  2347
    rws.Close();
sl@0
  2348
sl@0
  2349
    __UHEAP_MARKEND;
sl@0
  2350
    }
sl@0
  2351
sl@0
  2352
/*
sl@0
  2353
Tests 701-706 focus on window creation operating correctly, alternating use of the window size cache.
sl@0
  2354
Tests 707-710 aim to cover state transitions for cache entries in the window size cache for RWindow.
sl@0
  2355
Tests 711-712 performs basic verification of size related functionality for RBlankWindow and RBackedUpWindow.
sl@0
  2356
Test 713 focusses on ensuring a performance gain is achieved with window size caching enabled.
sl@0
  2357
Tests 714-720 aim to stress the window size cache with pseudo-random sequences of RWindow size related functions.
sl@0
  2358
sl@0
  2359
The states in the state machine model used for testing the RWindow size cache in tests 707-710 is as follows:
sl@0
  2360
sl@0
  2361
State: Initial
sl@0
  2362
    Window not yet in existence
sl@0
  2363
   
sl@0
  2364
State 0: No Cache entry
sl@0
  2365
    Window created, window size cache does not contain an entry for this window
sl@0
  2366
    
sl@0
  2367
State 1: Cache entry exists, cache clean
sl@0
  2368
    Window created, window size cache exists, contains a valid size
sl@0
  2369
    
sl@0
  2370
State 2: Cache entry exists, cache dirty
sl@0
  2371
    Window created, window size cache exists, does not contain a valid size
sl@0
  2372
    
sl@0
  2373
State: Final
sl@0
  2374
    Window destroyed
sl@0
  2375
 */
sl@0
  2376
void CTWindowSizeCacheTest::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
  2377
    {
sl@0
  2378
    _LIT(KTest1,"Create RWindow, window size cache off");
sl@0
  2379
    _LIT(KTest2,"Create RWindow, window size cache on");
sl@0
  2380
    _LIT(KTest3,"Create RBlankWindow, window size cache off");
sl@0
  2381
    _LIT(KTest4,"Create RBlankWindow, window size cache on");
sl@0
  2382
    _LIT(KTest5,"Create RBackedUpWindow, window size cache off");
sl@0
  2383
    _LIT(KTest6,"Create RBackedUpWindow, window size cache on");
sl@0
  2384
    
sl@0
  2385
    _LIT(KTest7,"RWindow - No cache entry");
sl@0
  2386
    _LIT(KTest8,"RWindow - Cache entry exists, cache clean");
sl@0
  2387
    _LIT(KTest9,"RWindow - Cache entry exists, cache dirty");
sl@0
  2388
    _LIT(KTest10,"RWindow - Cache entry exists, cache dirty->clean");
sl@0
  2389
   
sl@0
  2390
    _LIT(KTest11,"RBlankWindow size cache");
sl@0
  2391
    _LIT(KTest12,"RBackedUpWindow size cache");
sl@0
  2392
sl@0
  2393
    _LIT(KTest13,"RWindow Size Performance");
sl@0
  2394
    _LIT(KTest14,"RWindow Randomised Stress window size cache off");
sl@0
  2395
    _LIT(KTest15,"RWindow Randomised Stress window size cache on");
sl@0
  2396
    _LIT(KTest16,"RWindow Randomised Stress MultiSession cache off");
sl@0
  2397
    _LIT(KTest17,"RWindow Randomised Stress MultiSession cache on");
sl@0
  2398
    _LIT(KTest18,"RWindow Randomised Stress Entry Volume cache off");
sl@0
  2399
    _LIT(KTest19,"RWindow Randomised Stress Entry Volume cache on");
sl@0
  2400
    _LIT(KTest20,"RWsSession stress EnableWindowSizeCacheL");
sl@0
  2401
sl@0
  2402
    const TDisplayMode displayMode = EColor16MAP;
sl@0
  2403
    const TUint KPerformanceIterations = 50000;
sl@0
  2404
    const TUint KStressTestIterations = 3000;
sl@0
  2405
    const TUint KStressWindowPoolSize = 100;
sl@0
  2406
    
sl@0
  2407
    ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
  2408
sl@0
  2409
    switch(++iTest->iState)
sl@0
  2410
        {
sl@0
  2411
/**
sl@0
  2412
@SYMTestCaseID      GRAPHICS-WSERV-0701
sl@0
  2413
sl@0
  2414
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2415
sl@0
  2416
@SYMTestCaseDesc    Test creation and destruction for instances of RWindow, window size cache off 
sl@0
  2417
sl@0
  2418
@SYMTestPriority    High
sl@0
  2419
sl@0
  2420
@SYMTestStatus      Implemented
sl@0
  2421
sl@0
  2422
@SYMTestActions     Creates an RWsSession, some RWindowGroup and RWindow instances, and closes them.
sl@0
  2423
sl@0
  2424
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2425
*/
sl@0
  2426
        case 1:
sl@0
  2427
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0701"));
sl@0
  2428
            iTest->LogSubTest(KTest1);
sl@0
  2429
            TestCreateRWindowL(ETestSizeCacheNotEnabled);
sl@0
  2430
            break;
sl@0
  2431
/**
sl@0
  2432
@SYMTestCaseID      GRAPHICS-WSERV-0702
sl@0
  2433
sl@0
  2434
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2435
sl@0
  2436
@SYMTestCaseDesc    Test creation and destruction for instances of RWindow, window size cache on 
sl@0
  2437
sl@0
  2438
@SYMTestPriority    High
sl@0
  2439
sl@0
  2440
@SYMTestStatus      Implemented
sl@0
  2441
sl@0
  2442
@SYMTestActions     Creates an RWsSession, enables window size cache, creates some RWindowGroup and RWindow instances, and closes them.
sl@0
  2443
sl@0
  2444
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2445
*/
sl@0
  2446
        case 2:
sl@0
  2447
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0702"));
sl@0
  2448
            iTest->LogSubTest(KTest2);
sl@0
  2449
            TestCreateRWindowL(ETestSizeCacheEnabled);
sl@0
  2450
            break;
sl@0
  2451
/**
sl@0
  2452
@SYMTestCaseID      GRAPHICS-WSERV-0703
sl@0
  2453
sl@0
  2454
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2455
sl@0
  2456
@SYMTestCaseDesc    Test creation and destruction for instances of RBlankWindow, window size cache off 
sl@0
  2457
sl@0
  2458
@SYMTestPriority    High
sl@0
  2459
sl@0
  2460
@SYMTestStatus      Implemented
sl@0
  2461
sl@0
  2462
@SYMTestActions     Creates an RWsSession, creates some RWindowGroup and RBlankWindow instances, and closes them.
sl@0
  2463
sl@0
  2464
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2465
*/
sl@0
  2466
        case 3:
sl@0
  2467
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0703"));
sl@0
  2468
            iTest->LogSubTest(KTest3);
sl@0
  2469
            TestCreateRBlankWindowL(ETestSizeCacheNotEnabled);
sl@0
  2470
            break;
sl@0
  2471
/**
sl@0
  2472
@SYMTestCaseID      GRAPHICS-WSERV-0704
sl@0
  2473
sl@0
  2474
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2475
sl@0
  2476
@SYMTestCaseDesc    Test creation and destruction for instances of RBlankWindow, window size cache on 
sl@0
  2477
sl@0
  2478
@SYMTestPriority    High
sl@0
  2479
sl@0
  2480
@SYMTestStatus      Implemented
sl@0
  2481
sl@0
  2482
@SYMTestActions     Creates an RWsSession, enables window size cache, creates some RWindowGroup and RBlankWindow instances, and closes them.
sl@0
  2483
sl@0
  2484
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2485
*/
sl@0
  2486
        case 4:
sl@0
  2487
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0704"));
sl@0
  2488
            iTest->LogSubTest(KTest4);
sl@0
  2489
            TestCreateRBlankWindowL(ETestSizeCacheEnabled);
sl@0
  2490
            break;
sl@0
  2491
/**
sl@0
  2492
@SYMTestCaseID      GRAPHICS-WSERV-0705
sl@0
  2493
sl@0
  2494
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2495
sl@0
  2496
@SYMTestCaseDesc    Test creation and destruction for instances of RBackedUpWindow, window size cache off
sl@0
  2497
sl@0
  2498
@SYMTestPriority    High
sl@0
  2499
sl@0
  2500
@SYMTestStatus      Implemented
sl@0
  2501
sl@0
  2502
@SYMTestActions     Creates an RWsSession, creates some RWindowGroup and RBackedUpWindow instances, and closes them.
sl@0
  2503
sl@0
  2504
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2505
*/
sl@0
  2506
        case 5:
sl@0
  2507
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0705"));
sl@0
  2508
            iTest->LogSubTest(KTest5);
sl@0
  2509
            TestCreateRBackedUpWindowL(ETestSizeCacheNotEnabled, displayMode);
sl@0
  2510
            break;
sl@0
  2511
/**
sl@0
  2512
@SYMTestCaseID      GRAPHICS-WSERV-0706
sl@0
  2513
sl@0
  2514
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2515
sl@0
  2516
@SYMTestCaseDesc    Test creation and destruction for instances of RBackedUpWindow, window size cache on 
sl@0
  2517
sl@0
  2518
@SYMTestPriority    High
sl@0
  2519
sl@0
  2520
@SYMTestStatus      Implemented
sl@0
  2521
sl@0
  2522
@SYMTestActions     Creates an RWsSession, enables window size cache, creates some RWindowGroup and RBackedUpWindow instances, and closes them.
sl@0
  2523
sl@0
  2524
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2525
*/
sl@0
  2526
        case 6:
sl@0
  2527
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0706"));
sl@0
  2528
            iTest->LogSubTest(KTest6);
sl@0
  2529
            TestCreateRBackedUpWindowL(ETestSizeCacheEnabled, displayMode);
sl@0
  2530
            break;
sl@0
  2531
/**
sl@0
  2532
@SYMTestCaseID      GRAPHICS-WSERV-0707
sl@0
  2533
sl@0
  2534
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2535
sl@0
  2536
@SYMTestCaseDesc    Test RWindow size cache - State: No Cache Entry  
sl@0
  2537
sl@0
  2538
@SYMTestPriority    High
sl@0
  2539
sl@0
  2540
@SYMTestStatus      Implemented
sl@0
  2541
sl@0
  2542
@SYMTestActions     Perform the following with window size cache on and off:
sl@0
  2543
                        Create RWsSession, creates RWindowGroup and RWindow.
sl@0
  2544
                        Perform one of SetExtent/SetSize/SetExtentErr/SetSizeErr/EnableWindowSizeCacheL.
sl@0
  2545
                        Clean up.
sl@0
  2546
                        
sl@0
  2547
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2548
*/
sl@0
  2549
        case 7:
sl@0
  2550
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0707"));
sl@0
  2551
            iTest->LogSubTest(KTest7);
sl@0
  2552
            TestRWindowNoCacheEntryL(ETestSizeCacheNotEnabled);
sl@0
  2553
            TestRWindowNoCacheEntryL(ETestSizeCacheEnabled);
sl@0
  2554
            TestRWindowNoCacheEntrySetExtentErrL(ETestSizeCacheNotEnabled);
sl@0
  2555
            TestRWindowNoCacheEntrySetExtentErrL(ETestSizeCacheEnabled);
sl@0
  2556
            TestRWindowNoCacheEntrySetSizeErrL(ETestSizeCacheNotEnabled);
sl@0
  2557
            TestRWindowNoCacheEntrySetSizeErrL(ETestSizeCacheEnabled);
sl@0
  2558
            TestRWindowNoCacheEntrySetExtentL(ETestSizeCacheNotEnabled);
sl@0
  2559
            TestRWindowNoCacheEntrySetExtentL(ETestSizeCacheEnabled);
sl@0
  2560
            TestRWindowNoCacheEntrySetSizeL(ETestSizeCacheNotEnabled);
sl@0
  2561
            TestRWindowNoCacheEntrySetSizeL(ETestSizeCacheEnabled);
sl@0
  2562
            TestRWindowNoCacheEntryEnableWindowSizeCacheL();
sl@0
  2563
            break;
sl@0
  2564
sl@0
  2565
/**
sl@0
  2566
@SYMTestCaseID      GRAPHICS-WSERV-0708
sl@0
  2567
sl@0
  2568
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2569
sl@0
  2570
@SYMTestCaseDesc    Test RWindow size cache State: Cache entry exists, cache clean 
sl@0
  2571
sl@0
  2572
@SYMTestPriority    High
sl@0
  2573
sl@0
  2574
@SYMTestStatus      Implemented
sl@0
  2575
sl@0
  2576
@SYMTestActions     Perform the following with window size cache on and off:
sl@0
  2577
                        Create RWsSession, creates RWindowGroup and RWindow, calls SetSize.
sl@0
  2578
                        Perform one of Size/EnableWindowSizeCacheL.
sl@0
  2579
                        Check that size returned matches expected size.
sl@0
  2580
                        Clean up.
sl@0
  2581
                        
sl@0
  2582
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2583
*/
sl@0
  2584
        case 8:
sl@0
  2585
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0708"));
sl@0
  2586
            iTest->LogSubTest(KTest8);
sl@0
  2587
            TestRWindowCacheEntryExistsCacheCleanL(ETestSizeCacheNotEnabled);
sl@0
  2588
            TestRWindowCacheEntryExistsCacheCleanL(ETestSizeCacheEnabled);
sl@0
  2589
            TestRWindowCacheEntryExistsCacheCleanSizeL(ETestSizeCacheNotEnabled);
sl@0
  2590
            TestRWindowCacheEntryExistsCacheCleanSizeL(ETestSizeCacheEnabled);
sl@0
  2591
            TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL();
sl@0
  2592
            TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL();
sl@0
  2593
            break;
sl@0
  2594
sl@0
  2595
/**
sl@0
  2596
@SYMTestCaseID      GRAPHICS-WSERV-0709
sl@0
  2597
sl@0
  2598
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2599
sl@0
  2600
@SYMTestCaseDesc    Test RWindow size cache State: Cache entry exists, cache dirty
sl@0
  2601
sl@0
  2602
@SYMTestPriority    High
sl@0
  2603
sl@0
  2604
@SYMTestStatus      Implemented
sl@0
  2605
sl@0
  2606
@SYMTestActions     Perform the following with window size cache on and off:
sl@0
  2607
                        Create RWsSession, creates RWindowGroup and RWindow.
sl@0
  2608
                        Calls SetSize, Size, then SetSize to enter state with dirty cache entry.
sl@0
  2609
                        Perform combinations of SetSize/SetExtent/SetSizeErr/SetExtentErr/EnableWindowSizeCacheL.
sl@0
  2610
                        Check that size returned matches the last size set on the window whenever size is queried.
sl@0
  2611
                        Clean up.
sl@0
  2612
                        
sl@0
  2613
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2614
*/
sl@0
  2615
        case 9:
sl@0
  2616
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0709"));
sl@0
  2617
            iTest->LogSubTest(KTest9);
sl@0
  2618
            TestRWindowCacheEntryExistsCacheDirtySetSizeL(ETestSizeCacheNotEnabled);
sl@0
  2619
            TestRWindowCacheEntryExistsCacheDirtySetSizeL(ETestSizeCacheEnabled);
sl@0
  2620
            TestRWindowCacheEntryExistsCacheDirtySetExtentL(ETestSizeCacheNotEnabled);
sl@0
  2621
            TestRWindowCacheEntryExistsCacheDirtySetExtentL(ETestSizeCacheEnabled);
sl@0
  2622
            TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(ETestSizeCacheNotEnabled);
sl@0
  2623
            TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(ETestSizeCacheEnabled);
sl@0
  2624
            TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(ETestSizeCacheNotEnabled);
sl@0
  2625
            TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(ETestSizeCacheEnabled);
sl@0
  2626
            TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(ETestSizeCacheNotEnabled);
sl@0
  2627
            TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(ETestSizeCacheEnabled);
sl@0
  2628
            TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(ETestSizeCacheNotEnabled);
sl@0
  2629
            TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(ETestSizeCacheEnabled);
sl@0
  2630
            TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(ETestSizeCacheNotEnabled);
sl@0
  2631
            TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(ETestSizeCacheEnabled);
sl@0
  2632
            TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(ETestSizeCacheNotEnabled);
sl@0
  2633
            TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(ETestSizeCacheEnabled);
sl@0
  2634
            TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL();
sl@0
  2635
            break;
sl@0
  2636
            
sl@0
  2637
            
sl@0
  2638
/**
sl@0
  2639
@SYMTestCaseID      GRAPHICS-WSERV-0710
sl@0
  2640
sl@0
  2641
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2642
sl@0
  2643
@SYMTestCaseDesc    Test RWindow size cache State: Cache entry exists, cache dirty -> State: Cache entry exists, cache clean 
sl@0
  2644
sl@0
  2645
@SYMTestPriority    High
sl@0
  2646
sl@0
  2647
@SYMTestStatus      Implemented
sl@0
  2648
sl@0
  2649
@SYMTestActions     Perform the following with window size cache on and off:
sl@0
  2650
                        Create RWsSession, creates RWindowGroup and RWindow.
sl@0
  2651
                        Calls SetSize, Size, to enter state with clean cache entry.
sl@0
  2652
                        Perform combinations of SetSize/SetExtent/SetSizeErr/SetExtentErr/EnableWindowSizeCacheL to enter state with dirty cache entry.
sl@0
  2653
                        Calls RWindow::Size to re-enter state with clean cache entry.
sl@0
  2654
                        Check that size returned matches the last size set on the window whenever size is queried.
sl@0
  2655
                        Clean up.
sl@0
  2656
 
sl@0
  2657
@SYMTestExpectedResults Window objects created successfully, no memory leaks.
sl@0
  2658
*/
sl@0
  2659
        case 10:
sl@0
  2660
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0710"));
sl@0
  2661
            iTest->LogSubTest(KTest10);
sl@0
  2662
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(ETestSizeCacheNotEnabled);
sl@0
  2663
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(ETestSizeCacheEnabled);
sl@0
  2664
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(ETestSizeCacheNotEnabled);
sl@0
  2665
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(ETestSizeCacheEnabled);
sl@0
  2666
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(ETestSizeCacheNotEnabled);
sl@0
  2667
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(ETestSizeCacheEnabled);
sl@0
  2668
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(ETestSizeCacheNotEnabled);
sl@0
  2669
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(ETestSizeCacheEnabled);
sl@0
  2670
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(ETestSizeCacheNotEnabled);
sl@0
  2671
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(ETestSizeCacheEnabled);
sl@0
  2672
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(ETestSizeCacheNotEnabled);
sl@0
  2673
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(ETestSizeCacheEnabled);
sl@0
  2674
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(ETestSizeCacheNotEnabled);
sl@0
  2675
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(ETestSizeCacheEnabled);
sl@0
  2676
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(ETestSizeCacheNotEnabled);
sl@0
  2677
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(ETestSizeCacheEnabled);
sl@0
  2678
            TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL();
sl@0
  2679
            break;
sl@0
  2680
sl@0
  2681
/**
sl@0
  2682
@SYMTestCaseID      GRAPHICS-WSERV-0711
sl@0
  2683
sl@0
  2684
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2685
sl@0
  2686
@SYMTestCaseDesc    Test RBlankWindow Size cache behaviour 
sl@0
  2687
sl@0
  2688
@SYMTestPriority    High
sl@0
  2689
sl@0
  2690
@SYMTestStatus      Implemented
sl@0
  2691
sl@0
  2692
@SYMTestActions     Utilises RBlankWindow::SetSize, RBlankWindow::SetExtent, RBlankWindow::Size.
sl@0
  2693
                    Checks size returned by RBlankWindow::Size.
sl@0
  2694
                    Cleans up.
sl@0
  2695
sl@0
  2696
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size returned should be last size set on window
sl@0
  2697
*/
sl@0
  2698
        case 11:
sl@0
  2699
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0711"));
sl@0
  2700
            iTest->LogSubTest(KTest11);
sl@0
  2701
            TestRBlankWindowSetSizeSetExtentL(ETestSizeCacheNotEnabled);
sl@0
  2702
            TestRBlankWindowSetSizeSetExtentL(ETestSizeCacheEnabled);
sl@0
  2703
            break;
sl@0
  2704
/**
sl@0
  2705
@SYMTestCaseID      GRAPHICS-WSERV-0712
sl@0
  2706
sl@0
  2707
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2708
sl@0
  2709
@SYMTestCaseDesc    Test RBackedUpWindow Size cache behaviour 
sl@0
  2710
sl@0
  2711
@SYMTestPriority    High
sl@0
  2712
sl@0
  2713
@SYMTestStatus      Implemented
sl@0
  2714
sl@0
  2715
@SYMTestActions     Utilises RBackedUpWindow::SetSizeErr, RBackedUpWindow::SetExtentErr, RBackedUpWindow::Size.
sl@0
  2716
                    Checks size returned by RBackedUpWindow::Size.
sl@0
  2717
                    Cleans up.
sl@0
  2718
sl@0
  2719
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size returned should be last size set on window
sl@0
  2720
*/
sl@0
  2721
        case 12:
sl@0
  2722
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0712"));
sl@0
  2723
            iTest->LogSubTest(KTest12);
sl@0
  2724
            TestRBackedUpWindowSetSizeErrSetExtentErrL(ETestSizeCacheNotEnabled);
sl@0
  2725
            TestRBackedUpWindowSetSizeErrSetExtentErrL(ETestSizeCacheEnabled);
sl@0
  2726
            break;
sl@0
  2727
            
sl@0
  2728
/**
sl@0
  2729
@SYMTestCaseID      GRAPHICS-WSERV-0713
sl@0
  2730
sl@0
  2731
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2732
sl@0
  2733
@SYMTestCaseDesc    Compare performance of RWindow::Size function with size cache on and off 
sl@0
  2734
sl@0
  2735
@SYMTestPriority    High
sl@0
  2736
sl@0
  2737
@SYMTestStatus      Implemented
sl@0
  2738
sl@0
  2739
@SYMTestActions     Creates an RWsSession, optionally enables window size cache, creates an RWindowGroup and an RWindow 
sl@0
  2740
                    Calls RWindow::Size KPerformanceIterations times.
sl@0
  2741
                    Measures time taken - with and without size cache enabled
sl@0
  2742
sl@0
  2743
@SYMTestExpectedResults Window objects created successfully, no memory leaks, time taken for KPerformanceIterations RWindow::Size() calls with cache enabled should be faster.
sl@0
  2744
*/
sl@0
  2745
        case 13:
sl@0
  2746
            {
sl@0
  2747
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0713"));
sl@0
  2748
            iTest->LogSubTest(KTest13);
sl@0
  2749
            TUint64 sizeCacheOffDeltaMicroSeconds = TestRWindowSizePerformanceL(ETestSizeCacheNotEnabled, KPerformanceIterations);
sl@0
  2750
            TUint64 sizeCacheOnDeltaMicroSeconds = TestRWindowSizePerformanceL(ETestSizeCacheEnabled, KPerformanceIterations);
sl@0
  2751
            TEST(sizeCacheOnDeltaMicroSeconds < sizeCacheOffDeltaMicroSeconds);
sl@0
  2752
            INFO_PRINTF1(_L("Accessing size using cache is faster"));
sl@0
  2753
            }
sl@0
  2754
            break;
sl@0
  2755
/**
sl@0
  2756
@SYMTestCaseID      GRAPHICS-WSERV-0714
sl@0
  2757
sl@0
  2758
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2759
sl@0
  2760
@SYMTestCaseDesc    Randomised stress test - RWindow size related functions
sl@0
  2761
sl@0
  2762
@SYMTestPriority    High
sl@0
  2763
sl@0
  2764
@SYMTestStatus      Implemented
sl@0
  2765
sl@0
  2766
@SYMTestActions     Creates an RWsSession, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up.
sl@0
  2767
sl@0
  2768
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window
sl@0
  2769
*/
sl@0
  2770
        case 14:
sl@0
  2771
            {
sl@0
  2772
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0714"));
sl@0
  2773
            iTest->LogSubTest(KTest14);
sl@0
  2774
            TInt seed = Math::Random();
sl@0
  2775
            // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed
sl@0
  2776
            SetRandomSeed(seed);
sl@0
  2777
            TestRandomisedStressL(ETestSizeCacheNotEnabled, KStressTestIterations);
sl@0
  2778
            }
sl@0
  2779
            break;
sl@0
  2780
/**
sl@0
  2781
@SYMTestCaseID      GRAPHICS-WSERV-0714
sl@0
  2782
sl@0
  2783
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2784
sl@0
  2785
@SYMTestCaseDesc    Randomised stress test - RWindow size related functions, size cache on 
sl@0
  2786
sl@0
  2787
@SYMTestPriority    High
sl@0
  2788
sl@0
  2789
@SYMTestStatus      Implemented
sl@0
  2790
sl@0
  2791
@SYMTestActions     Creates an RWsSession, enables window size cache, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up.
sl@0
  2792
sl@0
  2793
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window
sl@0
  2794
*/
sl@0
  2795
        case 15:
sl@0
  2796
            {
sl@0
  2797
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0715"));
sl@0
  2798
            iTest->LogSubTest(KTest15);
sl@0
  2799
            TInt seed = Math::Random();
sl@0
  2800
            // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed
sl@0
  2801
            SetRandomSeed(seed);
sl@0
  2802
            TestRandomisedStressL(ETestSizeCacheEnabled, KStressTestIterations);
sl@0
  2803
            }
sl@0
  2804
            break;
sl@0
  2805
sl@0
  2806
            
sl@0
  2807
/**
sl@0
  2808
@SYMTestCaseID      GRAPHICS-WSERV-0716
sl@0
  2809
sl@0
  2810
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2811
sl@0
  2812
@SYMTestCaseDesc    Randomised stress test - RWindow size related functions, multiple sessions 
sl@0
  2813
sl@0
  2814
@SYMTestPriority    High
sl@0
  2815
sl@0
  2816
@SYMTestStatus      Implemented
sl@0
  2817
sl@0
  2818
@SYMTestActions     Creates two RWsSession instances, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up.
sl@0
  2819
sl@0
  2820
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window
sl@0
  2821
*/
sl@0
  2822
        case 16:
sl@0
  2823
            {
sl@0
  2824
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0716"));
sl@0
  2825
            iTest->LogSubTest(KTest16);
sl@0
  2826
            TInt seed = Math::Random();
sl@0
  2827
            // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed
sl@0
  2828
            SetRandomSeed(seed);
sl@0
  2829
            TestRandomisedStressMultiSessionL(ETestSizeCacheNotEnabled, KStressTestIterations);
sl@0
  2830
            }
sl@0
  2831
            break;
sl@0
  2832
/**
sl@0
  2833
@SYMTestCaseID      GRAPHICS-WSERV-0717
sl@0
  2834
sl@0
  2835
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2836
sl@0
  2837
@SYMTestCaseDesc    Randomised stress test - RWindow size related functions, multiple sessions, size cache on
sl@0
  2838
sl@0
  2839
@SYMTestPriority    High
sl@0
  2840
sl@0
  2841
@SYMTestStatus      Implemented
sl@0
  2842
sl@0
  2843
@SYMTestActions     Creates two RWsSession instances, enables window size cache, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up.
sl@0
  2844
sl@0
  2845
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window
sl@0
  2846
*/
sl@0
  2847
        case 17:
sl@0
  2848
            {
sl@0
  2849
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0717"));
sl@0
  2850
            iTest->LogSubTest(KTest17);
sl@0
  2851
            TInt seed = Math::Random();
sl@0
  2852
            // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed
sl@0
  2853
            SetRandomSeed(seed);
sl@0
  2854
            TestRandomisedStressMultiSessionL(ETestSizeCacheEnabled, KStressTestIterations);
sl@0
  2855
            }
sl@0
  2856
            break;
sl@0
  2857
sl@0
  2858
/**
sl@0
  2859
@SYMTestCaseID      GRAPHICS-WSERV-0718
sl@0
  2860
sl@0
  2861
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2862
sl@0
  2863
@SYMTestCaseDesc    Randomised stress test - RWindow size related functions, large number of windows 
sl@0
  2864
sl@0
  2865
@SYMTestPriority    High
sl@0
  2866
sl@0
  2867
@SYMTestStatus      Implemented
sl@0
  2868
sl@0
  2869
@SYMTestActions     Creates an RWsSession, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up.
sl@0
  2870
sl@0
  2871
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window
sl@0
  2872
*/
sl@0
  2873
        case 18:
sl@0
  2874
            {
sl@0
  2875
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0718"));
sl@0
  2876
            iTest->LogSubTest(KTest18);
sl@0
  2877
            TInt seed = Math::Random();
sl@0
  2878
            // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed
sl@0
  2879
            SetRandomSeed(seed);
sl@0
  2880
            TestRandomisedStressCacheEntryVolumeL(ETestSizeCacheNotEnabled, KStressTestIterations, KStressWindowPoolSize);
sl@0
  2881
            }
sl@0
  2882
            break;
sl@0
  2883
/**
sl@0
  2884
@SYMTestCaseID      GRAPHICS-WSERV-0719
sl@0
  2885
sl@0
  2886
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2887
sl@0
  2888
@SYMTestCaseDesc    Randomised stress test - RWindow size related functions, large number of windows 
sl@0
  2889
sl@0
  2890
@SYMTestPriority    High
sl@0
  2891
sl@0
  2892
@SYMTestStatus      Implemented
sl@0
  2893
sl@0
  2894
@SYMTestActions     Creates an RWsSession, enables window size cache, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up.
sl@0
  2895
sl@0
  2896
@SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window
sl@0
  2897
*/
sl@0
  2898
        case 19:
sl@0
  2899
            {
sl@0
  2900
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0719"));
sl@0
  2901
            iTest->LogSubTest(KTest19);
sl@0
  2902
            TInt seed = Math::Random();
sl@0
  2903
            // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed
sl@0
  2904
            SetRandomSeed(seed);
sl@0
  2905
            TestRandomisedStressCacheEntryVolumeL(ETestSizeCacheEnabled, KStressTestIterations, KStressWindowPoolSize);
sl@0
  2906
            }
sl@0
  2907
            break;
sl@0
  2908
sl@0
  2909
/**
sl@0
  2910
@SYMTestCaseID      GRAPHICS-WSERV-0720
sl@0
  2911
sl@0
  2912
@SYMDEF             DevCR BBRE-7UWGHL
sl@0
  2913
sl@0
  2914
@SYMTestCaseDesc    Test RWsSession::EnableWindowSizeCacheL() API 
sl@0
  2915
sl@0
  2916
@SYMTestPriority    High
sl@0
  2917
sl@0
  2918
@SYMTestStatus      Implemented
sl@0
  2919
sl@0
  2920
@SYMTestActions     Creates an RWsSession, calls EnableWindowSizeCacheL() multiple times, uses Size related APIs.
sl@0
  2921
sl@0
  2922
@SYMTestExpectedResults No memory leaks.
sl@0
  2923
*/
sl@0
  2924
        case 20:
sl@0
  2925
            {
sl@0
  2926
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0720"));
sl@0
  2927
            iTest->LogSubTest(KTest20);
sl@0
  2928
            TestStressEnableWindowSizeCacheL(KStressTestIterations);
sl@0
  2929
            }
sl@0
  2930
            break;
sl@0
  2931
        default:
sl@0
  2932
            ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
  2933
            ((CTWindowSizeCacheTestStep*)iStep)->CloseTMSGraphicsStep();
sl@0
  2934
            TestComplete();
sl@0
  2935
            break;
sl@0
  2936
        }
sl@0
  2937
    ((CTWindowSizeCacheTestStep*)iStep)->RecordTestResultL();
sl@0
  2938
    }
sl@0
  2939
sl@0
  2940
__WS_CONSTRUCT_STEP__(WindowSizeCacheTest)