Update contrib.
1 // Copyright (c) 1995-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\window\t_wjpwin.cpp
15 // (this test program is formerly known as T_GUI.H)
28 LOCAL_C void Fault(TFault aFault)
34 User::Panic(_L("T_WWINS fault"),aFault);
48 RTest test(_L("T_WWINS"));
50 test.Start(_L("GUI Test 1\n"));
51 TInt r=w.Init(_L("T_WWINS"),TSize(50,15));
52 __ASSERT_ALWAYS(r==KErrNone,Fault(EConsole));
53 for(TInt x=0;x<200;x++)
56 #if defined(_UNICODE) // K.K
57 unsigned char unicode_chars[] = {0x25,0x30,0x33,0x64,0x20,0x90,0xa2,0x8a,0x45,0x82,0xe6,0x20,0x82,0xb1,0x82,0xf1,0x82,0xc9,0x82,0xbf,0x82,0xcd,13,10,0,0};
58 //b.Format(_L("%03d 世界よ こんにちは\r\n"),x);
59 b.Format(TPtrC16((unsigned short*)unicode_chars),x);
61 b.Format(_L("%03d hello world\r\n"),x);
70 TInt Test2Window2(TAny* /*aDirective*/)
74 __ASSERT_ALWAYS(r==KErrNone,Fault(EConsole));
75 r=w.Control(_L("+Scrollbars +Lock"));
76 r=w.Init(_L("T_WWINS Window 2"),TSize(50,15));
77 __ASSERT_ALWAYS(r==KErrNone,Fault(EConsole));
86 for(x=0;x<10000000 && s==KRequestPending;x++) {};
87 if (s!=KRequestPending)
89 w.Control(_L("-Scrollbars"));
90 for(x=0;x<10000000 && s==KRequestPending;x++) {};
91 if (s!=KRequestPending)
93 w.Control(_L("+Scrollbars"));
95 User::WaitForRequest(s);
98 TChar a=(TUint)k.Code();
107 User::Panic(_L("Read-Key"),0);
112 TInt Test2Window1(TAny* /*aDirective*/)
116 __ASSERT_ALWAYS(r==KErrNone,Fault(EConsole));
117 r=w.Control(_L("-Visibilty +Lock"));
118 r=w.Init(_L("T_WWINS Window 1"),TSize(50,15));
119 __ASSERT_ALWAYS(r==KErrNone,Fault(EConsole));
125 w.Write(_L("Hello world\r\n"));
127 w.Control(_L("+Visibilty"));
130 w.Write(_L("Hello world\r\n"));
132 w.Control(_L("-Visibility"));
137 void TestGui::Test2()
141 RTest test(_L("T_WWINS"));
143 test.Start(_L("GUI Test 2\n"));
144 x=t1.Create(_L("Thread1"),Test2Window1,KDefaultStackSize,0x2000,0x2000,(TAny*)1);
145 if(x==0) t1.Resume();
146 x=t2.Create(_L("Thread2"),Test2Window2,KDefaultStackSize,0x2000,0x2000,(TAny*)2);
147 if(x==0) t2.Resume();
149 TInt r=w.Init(_L("T_WWINS Window 3"),TSize(50,15));
150 __ASSERT_ALWAYS(r==KErrNone,Fault(EConsole));
160 #if defined(_UNICODE) // K.K
161 if (a >= 0x0061 && a <= 0x006a) a -= 0x0020;
163 if (a >= 0x0041 && a <= 0x005a) a+= 0xff00;
171 if(c==EKeyLeftArrow) w.SetCursorPosRel(TPoint(-1,0));
172 if(c==EKeyRightArrow) w.SetCursorPosRel(TPoint(1,0));
173 if(c==EKeyUpArrow) w.SetCursorPosRel(TPoint(0,-1));
174 if(c==EKeyDownArrow) w.SetCursorPosRel(TPoint(0,1));
175 if(c==EKeyF1) w.Control(_L("+Cursor"));
176 if(c==EKeyF2) w.Control(_L("-Cursor"));
177 if(c==EKeyF3) w.Control(_L("+Scroll"));
178 if(c==EKeyF4) w.Control(_L("-Scroll"));
179 if(c==EKeyF5) w.Control(_L("+Lock"));
180 if(c==EKeyF6) w.Control(_L("-Lock"));
181 if(c==EKeyF7) w.Control(_L("+Wrap"));
182 if(c==EKeyF8) w.Control(_L("-Wrap"));
183 if(c==EKeyF9) w.ClearToEndOfLine();
185 } while(k.Code()!=EKeyEscape);
194 // To get some data or bss into ths program
197 GLDEF_C TInt E32Main()
199 // Test the various kernel types.