0
|
1 |
// Copyright (c) 2007-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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Suspend test execution and display dialogue box on screen
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "sddialogbox.h"
|
|
19 |
|
|
20 |
/*
|
|
21 |
Class constructor
|
|
22 |
|
|
23 |
@param None
|
|
24 |
@return None
|
|
25 |
*/
|
|
26 |
CBaseTestSDDialogBox::CBaseTestSDDialogBox()
|
|
27 |
{
|
|
28 |
SetTestStepName(KTestStepDialogBox);
|
|
29 |
}
|
|
30 |
|
|
31 |
/*
|
|
32 |
Test Step Preamble
|
|
33 |
- Does nothing
|
|
34 |
|
|
35 |
@param None
|
|
36 |
@return EPass
|
|
37 |
@see TVerdict
|
|
38 |
*/
|
|
39 |
TVerdict CBaseTestSDDialogBox::doTestStepPreambleL()
|
|
40 |
{
|
|
41 |
SetTestStepResult(EPass);
|
|
42 |
return TestStepResult();
|
|
43 |
}
|
|
44 |
|
|
45 |
/*
|
|
46 |
Test step
|
|
47 |
|
|
48 |
@param None
|
|
49 |
@return EPass if successful or EFail if not
|
|
50 |
@see TVerdict
|
|
51 |
*/
|
|
52 |
TVerdict CBaseTestSDDialogBox::doTestStepL()
|
|
53 |
{
|
|
54 |
TInt r;
|
|
55 |
TPtrC pLine1;
|
|
56 |
TPtrC pLine2;
|
|
57 |
TPtrC pButton1;
|
|
58 |
TPtrC pButton2;
|
|
59 |
TInt buttonvalpass;
|
|
60 |
|
|
61 |
_LIT(KDialogBoxTextLine1, "DialogBoxTextLine1");
|
|
62 |
_LIT(KDialogBoxTextLine2, "DialogBoxTextLine2");
|
|
63 |
_LIT(KDialogBoxTextButton1, "DialogBoxTextButton1");
|
|
64 |
_LIT(KDialogBoxTextButton2, "DialogBoxTextButton2");
|
|
65 |
_LIT(KDialogBoxButtonValuePassCondition, "DialogBoxButtonValuePassCondition");
|
|
66 |
|
|
67 |
// Read the text to be displayed from the INI File
|
|
68 |
if (!GetStringFromConfig(ConfigSection(), KDialogBoxTextLine1, pLine1))
|
|
69 |
{
|
|
70 |
ERR_PRINTF1(_L("INI file read error - DialogBoxTextLine1"));
|
|
71 |
SetTestStepResult(EFail);
|
|
72 |
return TestStepResult();
|
|
73 |
}
|
|
74 |
if (!GetStringFromConfig(ConfigSection(), KDialogBoxTextLine2, pLine2))
|
|
75 |
{
|
|
76 |
ERR_PRINTF1(_L("INI file read error - DialogBoxTextLine2"));
|
|
77 |
SetTestStepResult(EFail);
|
|
78 |
return TestStepResult();
|
|
79 |
}
|
|
80 |
if (!GetStringFromConfig(ConfigSection(), KDialogBoxTextButton1, pButton1))
|
|
81 |
{
|
|
82 |
ERR_PRINTF1(_L("INI file read error - DialogBoxTextButton1"));
|
|
83 |
SetTestStepResult(EFail);
|
|
84 |
return TestStepResult();
|
|
85 |
}
|
|
86 |
if (!GetStringFromConfig(ConfigSection(), KDialogBoxTextButton2, pButton2))
|
|
87 |
{
|
|
88 |
ERR_PRINTF1(_L("INI file read error - DialogBoxTextButton2"));
|
|
89 |
SetTestStepResult(EFail);
|
|
90 |
return TestStepResult();
|
|
91 |
}
|
|
92 |
if (!GetIntFromConfig(ConfigSection(), KDialogBoxButtonValuePassCondition, buttonvalpass))
|
|
93 |
{
|
|
94 |
ERR_PRINTF1(_L("INI file read error - KDialogBoxButtonValuePassCondition"));
|
|
95 |
SetTestStepResult(EFail);
|
|
96 |
return TestStepResult();
|
|
97 |
}
|
|
98 |
|
|
99 |
TRequestStatus status;
|
|
100 |
RNotifier notif;
|
|
101 |
r = notif.Connect();
|
|
102 |
if (r != KErrNone)
|
|
103 |
{
|
|
104 |
ERR_PRINTF2(_L("RNotifier::Connect() - Error %d"), r);
|
|
105 |
SetTestStepResult(EFail);
|
|
106 |
return TestStepResult();
|
|
107 |
}
|
|
108 |
|
|
109 |
TInt buttonval;
|
|
110 |
notif.Notify(pLine1, pLine2, pButton1, pButton2, buttonval, status);
|
|
111 |
User::WaitForRequest(status);
|
|
112 |
|
|
113 |
if (buttonval + 1 == buttonvalpass)
|
|
114 |
{
|
|
115 |
INFO_PRINTF2(_L("User selected '%S'"), (buttonval ? &pButton2 : &pButton1));
|
|
116 |
SetTestStepResult(EPass);
|
|
117 |
}
|
|
118 |
else
|
|
119 |
{
|
|
120 |
ERR_PRINTF2(_L("User selected '%S'"), (buttonval ? &pButton2 : &pButton1));
|
|
121 |
SetTestStepResult(EFail);
|
|
122 |
}
|
|
123 |
|
|
124 |
notif.Close();
|
|
125 |
return TestStepResult();
|
|
126 |
}
|