First public contribution.
1 // Copyright (c) 1997-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\locale\t_msgtxt.cpp
15 // Tests the TLocaleMessageText class
22 LOCAL_D TBuf<KMaxLocaleMessageText>* localeBufs[ELocaleMessages_LastMsg];
24 RTest test(_L("T_MSGTXT"));
26 LOCAL_C void DisplayMessages()
28 // Display the locale messages
33 TInt r=notifier.Connect();
35 TRequestStatus status;
38 test.Next(_L("Test File Server Error Dialogs"));
39 TLocaleMessageText msgTxt;
40 msgTxt.Set(EFileServer_Button1);
41 TBuf<KMaxLocaleMessageText> button1(msgTxt);
42 msgTxt.Set(EFileServer_Button2);
43 TBuf<KMaxLocaleMessageText> button2(msgTxt);
45 test.Next(_L("DIALOG1: Displayed if a disk is removed during a write"));
47 test.Printf(_L("***Press SHIFT+R or SHIFT+S to confim dialogue***\n"));
49 msgTxt.Set((TLocaleMessage)count++);
50 TBuf<KMaxLocaleMessageText> line1=msgTxt;
51 msgTxt.Set((TLocaleMessage)count++);
52 TBuf<KMaxLocaleMessageText> line2=msgTxt;
53 notifier.Notify(line1,line2,button1,button2,buttonVal,status);
54 User::WaitForRequest(status);
57 test.Next(_L("DIALOG2: Write failed due to low power"));
59 msgTxt.Set((TLocaleMessage)count++);
61 msgTxt.Set((TLocaleMessage)count++);
63 notifier.Notify(line1,line2,button1,button2,buttonVal,status);
64 User::WaitForRequest(status);
67 test.Next(_L("DIALOG3: General error message - disk write failed"));
69 msgTxt.Set((TLocaleMessage)count++);
71 msgTxt.Set((TLocaleMessage)count++);
73 notifier.Notify(line1,line2,button1,button2,buttonVal,status);
74 User::WaitForRequest(status);
76 test.Printf(_L("***End***\n\n"));
78 msgTxt.Set((TLocaleMessage)count++);
79 test.Printf(_L("ALARMNAME: 'Chimes' - %S\n"),&msgTxt);
80 msgTxt.Set((TLocaleMessage)count++);
81 test.Printf(_L("ALARMNAME: 'Rings' - %S\n"),&msgTxt);
82 msgTxt.Set((TLocaleMessage)count++);
83 test.Printf(_L("ALARMNAME: 'Signal' - %S\n"),&msgTxt);
84 test.Printf(_L("***Press any key***\n\n"));
87 msgTxt.Set((TLocaleMessage)count++);
88 test.Printf(_L("DISKNAME: 'Internal' - %S\n"),&msgTxt);
89 msgTxt.Set((TLocaleMessage)count++);
90 test.Printf(_L("DISKNAME: 'External1' - %S\n"),&msgTxt);
91 msgTxt.Set((TLocaleMessage)count++);
92 test.Printf(_L("DISKNAME: 'External2' - %S\n"),&msgTxt);
93 msgTxt.Set((TLocaleMessage)count++);
94 test.Printf(_L("DISKNAME: 'External3' - %S\n"),&msgTxt);
95 msgTxt.Set((TLocaleMessage)count++);
96 test.Printf(_L("DISKNAME: 'External4' - %S\n"),&msgTxt);
97 msgTxt.Set((TLocaleMessage)count++);
98 test.Printf(_L("DISKNAME: 'External5' - %S\n"),&msgTxt);
99 msgTxt.Set((TLocaleMessage)count++);
100 test.Printf(_L("DISKNAME: 'External6' - %S\n"),&msgTxt);
101 msgTxt.Set((TLocaleMessage)count++);
102 test.Printf(_L("DISKNAME: 'External7' - %S\n"),&msgTxt);
103 msgTxt.Set((TLocaleMessage)count++);
104 test.Printf(_L("DISKNAME: 'External8' - %S\n"),&msgTxt);
105 test.Printf(_L("***Press any key***\n\n"));
108 msgTxt.Set((TLocaleMessage)count++);
109 test.Printf(_L("SOCKETNAME0: - %S\n"),&msgTxt);
110 msgTxt.Set((TLocaleMessage)count++);
111 test.Printf(_L("SOCKETNAME1: - %S\n"),&msgTxt);
112 msgTxt.Set((TLocaleMessage)count++);
113 test.Printf(_L("SOCKETNAME2: - %S\n"),&msgTxt);
114 msgTxt.Set((TLocaleMessage)count++);
115 test.Printf(_L("SOCKETNAME3: - %S\n"),&msgTxt);
126 // TBuf<KMaxLocaleMessageText>* localeBufs[ELocaleMessages_LastMsg]; {Too big for local decleration}
128 test.Start(_L("Constructor"));
129 TLocaleMessageText msgTxt;
130 msgTxt.Set((TLocaleMessage)4);
132 for (count=0;count<ELocaleMessages_LastMsg;count++)
134 TLocaleMessageText msgTxt((TLocaleMessage)count);
135 test.Printf(_L("Message %d = \"%S\"\n"),count,&msgTxt);
136 localeBufs[count]=new TBuf<KMaxLocaleMessageText>(msgTxt);
137 test(localeBufs[count]!=NULL);
140 test.Next(_L("Set"));
141 for (count=0;count<ELocaleMessages_LastMsg;count++)
143 TLocaleMessageText msgTxt((TLocaleMessage)count);
144 test((*localeBufs[count])==msgTxt);
147 for (count=0;count<ELocaleMessages_LastMsg;count++)
149 delete localeBufs[count];
152 test.Next(_L("Illegal values"));
153 TLocaleMessageText error((TLocaleMessage)0x1000000);
154 test(error.Length()==0);
156 error.Set((TLocaleMessage)0x1000000);
157 test(error.Length()==0);
158 TLocaleMessageText lastMsg(ELocaleMessages_LastMsg);
159 test(lastMsg.Length()==0);
160 lastMsg.SetLength(20);
161 lastMsg.Set(ELocaleMessages_LastMsg);
162 test(lastMsg.Length()==0);