20 #include <e32svr.h> |
20 #include <e32svr.h> |
21 |
21 |
22 LOCAL_D TBuf<KMaxLocaleMessageText>* localeBufs[ELocaleMessages_LastMsg]; |
22 LOCAL_D TBuf<KMaxLocaleMessageText>* localeBufs[ELocaleMessages_LastMsg]; |
23 |
23 |
24 RTest test(_L("T_MSGTXT")); |
24 RTest test(_L("T_MSGTXT")); |
|
25 |
|
26 const TUint KTimeOut=5000000; // 5 seconds timeout for the notifier |
25 |
27 |
26 LOCAL_C void DisplayMessages() |
28 LOCAL_C void DisplayMessages() |
27 // |
29 // |
28 // Display the locale messages |
30 // Display the locale messages |
29 // |
31 // |
30 { |
32 { |
31 |
|
32 RNotifier notifier; |
33 RNotifier notifier; |
33 TInt r=notifier.Connect(); |
34 TInt r=notifier.Connect(); |
34 test(r==KErrNone); |
35 test(r==KErrNone); |
35 TRequestStatus status; |
36 TRequestStatus status; |
|
37 TRequestStatus timerStatus; |
36 TInt buttonVal=0; |
38 TInt buttonVal=0; |
|
39 RTimer timer; |
|
40 timer.CreateLocal(); |
37 |
41 |
38 test.Next(_L("Test File Server Error Dialogs")); |
42 test.Next(_L("Test File Server Error Dialogs")); |
39 TLocaleMessageText msgTxt; |
43 TLocaleMessageText msgTxt; |
40 msgTxt.Set(EFileServer_Button1); |
44 msgTxt.Set(EFileServer_Button1); |
41 TBuf<KMaxLocaleMessageText> button1(msgTxt); |
45 TBuf<KMaxLocaleMessageText> button1(msgTxt); |
42 msgTxt.Set(EFileServer_Button2); |
46 msgTxt.Set(EFileServer_Button2); |
43 TBuf<KMaxLocaleMessageText> button2(msgTxt); |
47 TBuf<KMaxLocaleMessageText> button2(msgTxt); |
44 |
48 |
45 test.Next(_L("DIALOG1: Displayed if a disk is removed during a write")); |
49 test.Next(_L("DIALOG1: Displayed if a disk is removed during a write (will timeout in 5 seconds)")); |
46 User::After(300000); |
|
47 test.Printf(_L("***Press SHIFT+R or SHIFT+S to confim dialogue***\n")); |
|
48 TInt count=2; |
50 TInt count=2; |
49 msgTxt.Set((TLocaleMessage)count++); |
51 msgTxt.Set((TLocaleMessage)count++); |
50 TBuf<KMaxLocaleMessageText> line1=msgTxt; |
52 TBuf<KMaxLocaleMessageText> line1=msgTxt; |
51 msgTxt.Set((TLocaleMessage)count++); |
53 msgTxt.Set((TLocaleMessage)count++); |
52 TBuf<KMaxLocaleMessageText> line2=msgTxt; |
54 TBuf<KMaxLocaleMessageText> line2=msgTxt; |
53 notifier.Notify(line1,line2,button1,button2,buttonVal,status); |
55 notifier.Notify(line1,line2,button1,button2,buttonVal,status); |
54 User::WaitForRequest(status); |
56 timer.After(timerStatus,KTimeOut); |
55 User::After(300000); |
57 User::WaitForRequest(status,timerStatus); |
56 |
58 if (status==KRequestPending) |
57 test.Next(_L("DIALOG2: Write failed due to low power")); |
59 { |
58 User::After(300000); |
60 test.Printf(_L("Timeout in waiting for keypress, continuing\n")); |
|
61 // make the notifier to disappear |
|
62 TRawEvent eventDown; |
|
63 eventDown.Set(TRawEvent::EKeyDown,EStdKeyEnter); |
|
64 TRawEvent eventUp; |
|
65 eventUp.Set(TRawEvent::EKeyUp,EStdKeyEnter); |
|
66 UserSvr::AddEvent(eventDown); |
|
67 UserSvr::AddEvent(eventUp); |
|
68 } |
|
69 else |
|
70 { |
|
71 timer.Cancel(); |
|
72 } |
|
73 |
|
74 test.Next(_L("DIALOG2: Write failed due to low power (will timeout in 5 seconds)")); |
59 msgTxt.Set((TLocaleMessage)count++); |
75 msgTxt.Set((TLocaleMessage)count++); |
60 line1=msgTxt; |
76 line1=msgTxt; |
61 msgTxt.Set((TLocaleMessage)count++); |
77 msgTxt.Set((TLocaleMessage)count++); |
62 line2=msgTxt; |
78 line2=msgTxt; |
63 notifier.Notify(line1,line2,button1,button2,buttonVal,status); |
79 notifier.Notify(line1,line2,button1,button2,buttonVal,status); |
64 User::WaitForRequest(status); |
80 timer.After(timerStatus,KTimeOut); |
65 User::After(300000); |
81 User::WaitForRequest(status,timerStatus); |
66 |
82 if (status==KRequestPending) |
67 test.Next(_L("DIALOG3: General error message - disk write failed")); |
83 { |
68 User::After(300000); |
84 test.Printf(_L("Timeout in waiting for keypress, continuing\n")); |
|
85 // make the notifier to disappear |
|
86 TRawEvent eventDown; |
|
87 eventDown.Set(TRawEvent::EKeyDown,EStdKeyEnter); |
|
88 TRawEvent eventUp; |
|
89 eventUp.Set(TRawEvent::EKeyUp,EStdKeyEnter); |
|
90 UserSvr::AddEvent(eventDown); |
|
91 UserSvr::AddEvent(eventUp); |
|
92 } |
|
93 else |
|
94 { |
|
95 timer.Cancel(); |
|
96 } |
|
97 |
|
98 test.Next(_L("DIALOG3: General error message - disk write failed (will timeout in 5 seconds)")); |
69 msgTxt.Set((TLocaleMessage)count++); |
99 msgTxt.Set((TLocaleMessage)count++); |
70 line1=msgTxt; |
100 line1=msgTxt; |
71 msgTxt.Set((TLocaleMessage)count++); |
101 msgTxt.Set((TLocaleMessage)count++); |
72 line2=msgTxt; |
102 line2=msgTxt; |
73 notifier.Notify(line1,line2,button1,button2,buttonVal,status); |
103 notifier.Notify(line1,line2,button1,button2,buttonVal,status); |
74 User::WaitForRequest(status); |
104 timer.After(timerStatus,KTimeOut); |
75 User::After(300000); |
105 User::WaitForRequest(status,timerStatus); |
|
106 if (status==KRequestPending) |
|
107 { |
|
108 test.Printf(_L("Timeout in waiting for keypress, continuing\n")); |
|
109 // make the notifier to disappear |
|
110 TRawEvent eventDown; |
|
111 eventDown.Set(TRawEvent::EKeyDown,EStdKeyEnter); |
|
112 TRawEvent eventUp; |
|
113 eventUp.Set(TRawEvent::EKeyUp,EStdKeyEnter); |
|
114 UserSvr::AddEvent(eventDown); |
|
115 UserSvr::AddEvent(eventUp); |
|
116 } |
|
117 else |
|
118 { |
|
119 timer.Cancel(); |
|
120 } |
|
121 |
|
122 timer.Close(); |
76 test.Printf(_L("***End***\n\n")); |
123 test.Printf(_L("***End***\n\n")); |
77 |
124 |
78 msgTxt.Set((TLocaleMessage)count++); |
125 msgTxt.Set((TLocaleMessage)count++); |
79 test.Printf(_L("ALARMNAME: 'Chimes' - %S\n"),&msgTxt); |
126 test.Printf(_L("ALARMNAME: 'Chimes' - %S\n"),&msgTxt); |
80 msgTxt.Set((TLocaleMessage)count++); |
127 msgTxt.Set((TLocaleMessage)count++); |
81 test.Printf(_L("ALARMNAME: 'Rings' - %S\n"),&msgTxt); |
128 test.Printf(_L("ALARMNAME: 'Rings' - %S\n"),&msgTxt); |
82 msgTxt.Set((TLocaleMessage)count++); |
129 msgTxt.Set((TLocaleMessage)count++); |
83 test.Printf(_L("ALARMNAME: 'Signal' - %S\n"),&msgTxt); |
130 test.Printf(_L("ALARMNAME: 'Signal' - %S\n"),&msgTxt); |
84 test.Printf(_L("***Press any key***\n\n")); |
|
85 test.Getch(); |
|
86 |
131 |
87 msgTxt.Set((TLocaleMessage)count++); |
132 msgTxt.Set((TLocaleMessage)count++); |
88 test.Printf(_L("DISKNAME: 'Internal' - %S\n"),&msgTxt); |
133 test.Printf(_L("DISKNAME: 'Internal' - %S\n"),&msgTxt); |
89 msgTxt.Set((TLocaleMessage)count++); |
134 msgTxt.Set((TLocaleMessage)count++); |
90 test.Printf(_L("DISKNAME: 'External1' - %S\n"),&msgTxt); |
135 test.Printf(_L("DISKNAME: 'External1' - %S\n"),&msgTxt); |