Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\emul\t_guiconfig.cpp
16 // Test the kernel-side emulator GUI configuration API.
18 // RBusLogicalChannel, DLogicalChannel, WinsGui::CurrentConfiguration.
20 // - Test retrieving the current emulator GUI configuration.
21 // The following emulator configuration (.ini) files can be used with
22 // this test to setup multiple configurations. Switch from one
23 // configuration to the next by clicking in the upper left corner of
24 // the emulator window, then run the test with a different configuration
26 // >>> \epoc32\data\epoc.ini <<<
27 // configuration c0.ini
28 // configuration c1.ini
29 // configuration c2.ini
30 // configuration c3.ini
31 // >>> \epoc32\data\c0.ini <<<
32 // OnActivation 0 EKeyScreenDimension0
33 // EmulatorControl NextConfig rect 1,1 30,30
35 // >>> \epoc32\data\c1.ini <<<
36 // OnActivation 0 EKeyScreenDimension1
37 // EmulatorControl NextConfig rect 1,1 30,30
39 // >>> \epoc32\data\c2.ini <<<
40 // OnActivation 0 EKeyScreenDimension2
41 // EmulatorControl NextConfig rect 1,1 30,30
43 // >>> \epoc32\data\c3.ini <<<
44 // OnActivation 0 EKeyScreenDimension3
45 // EmulatorControl NextConfig rect 1,1 30,30
47 // Platforms/Drives/Compatibility:
48 // Only available on the emulator.
49 // Assumptions/Requirement/Pre-requisites:
50 // Failures and causes:
51 // Base Port information:
57 #include <e32def_private.h>
58 #include "d_guiconfig.h"
60 _LIT(KLddFileName, "d_guiconfig.ldd");
62 GLDEF_D RGuiConfigTest ldd;
63 GLDEF_D RTest test(_L("Emulator GUI configuration"));
65 void DoTest(const TDesC& aLddFileName)
68 test.Start(_L("Loading LDD"));
72 r=User::LoadLogicalDevice(aLddFileName);
73 test.Printf(_L("Returned %d\n"), r);
76 test.Next(_L("Opening device driver"));
77 test(ldd.Open()==KErrNone);
79 test.Next(_L("Test retrieving current GUI configuration"));
80 test.Printf(_L("Current emulator configuration is: %d"), ldd.GetConfig());
82 test.Next(_L("Test generating key event"));
83 test(ldd.GenerateKeyEvent()==KErrNone);
85 TRequestStatus status;
86 test.Console()->Read(status);
87 User::WaitForRequest(status);
89 if (test.Console()->KeyCode() == EKeyScreenDimension0)
91 test.Printf(_L("EKeyScreenDimension0 (0x%04x)\r\n"), test.Console()->KeyCode());
92 // wait for the key-up code
93 test.Console()->Read(status);
94 User::WaitForRequest(status);
96 test(test.Console()->KeyCode() == EKeyScreenDimension0);
98 else if (test.Console()->KeyCode()==EKeyScreenDimension1)
100 test.Printf(_L("EKeyScreenDimension1 (0x%04x)\r\n"), test.Console()->KeyCode());
101 // wait for the key-up code
102 test.Console()->Read(status);
103 User::WaitForRequest(status);
105 test(test.Console()->KeyCode() == EKeyScreenDimension1);
107 else if (test.Console()->KeyCode() == EKeyScreenDimension2)
109 test.Printf(_L("EKeyScreenDimension2 (0x%04x)\r\n"), test.Console()->KeyCode());
110 // wait for the key-up code
111 test.Console()->Read(status);
112 User::WaitForRequest(status);
114 test(test.Console()->KeyCode() == EKeyScreenDimension2);
116 else if (test.Console()->KeyCode() == EKeyScreenDimension3)
118 test.Printf(_L("EKeyScreenDimension3 (0x%04x)\r\n"), test.Console()->KeyCode());
119 // wait for the key-up code
120 test.Console()->Read(status);
121 User::WaitForRequest(status);
123 test(test.Console()->KeyCode() == EKeyScreenDimension3);
127 test.Printf(_L("Key: %5d (0x%04x)\r\n"),test.Console()->KeyCode(),test.Console()->KeyCode());
131 test.Next(_L("Close"));
134 test.Next(_L("Unload"));
135 r = RGuiConfigTest::Unload();
141 GLDEF_C TInt E32Main()
143 // Test LDD static data
147 test.Start(_L("Test emulator GUI configuration API"));
149 DoTest(KLddFileName);