Skip to content

Commit 1789dd9

Browse files
committed
b-169 fixed a startup behavior
1 parent af60b54 commit 1789dd9

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

src/modules/services/startactionsengine.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ bool StartActionsEngine::execute(StartParams &startParams)
5757
Utils::error(NULL, tr(""));
5858
return false;
5959
}
60-
if(_data->isUserFirstAccess()) {
60+
const bool wasFirstAccess = _data->isUserFirstAccess();
61+
if(wasFirstAccess) {
6162
_executor->startActionShowUserTypePanel();
6263
_data->fireUserFirstAccess();
6364
}
@@ -66,7 +67,9 @@ bool StartActionsEngine::execute(StartParams &startParams)
6667
_executor->startActionShowGuidedOperationsPanel();
6768
} else {
6869
// editor view detail level
69-
_executor->startActionSetupFirstAccessForPreferences();
70+
if(wasFirstAccess) {
71+
_executor->startActionSetupFirstAccessForPreferences();
72+
}
7073
}
7174

7275
switch(startParams.type) {

test/teststartupandbehavior.cpp

+27-10
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,26 @@ TestStartupAndBehavior::~TestStartupAndBehavior()
119119
//
120120
}
121121

122+
/*
123+
&id,
124+
// set values
125+
setFirstAccess, setOpenFile, ApplicationData::EUserType setUserType,
126+
// -- expected
127+
AskUserTypePanel, expectedOpenGuidedPanel, AskVisDetailsTypePanel,
128+
ShowWelcome, OpenFile, panelUserType,
129+
Test User Argument Access Ask User TyPanel(s) Run
130+
6 Basic *** Following No Operations ***
131+
7 Basic Open File Following No Operations Open File
132+
*/
133+
122134
bool TestStartupAndBehavior::testFast()
123135
{
124-
return testUnit();
136+
if(!checkStartupAction("6", false, false, ApplicationData::UserTypeGuided,
137+
false, true, false, false, false, ApplicationData::UserTypeGuided,
138+
ApplicationData::UserTypeGuided )) {
139+
return false;
140+
}
141+
return true ;
125142
}
126143

127144
/**
@@ -149,31 +166,31 @@ bool TestStartupAndBehavior::testUnit()
149166
return false;
150167
}
151168
if(!checkStartupAction("2", false, false, ApplicationData::UserTypeExpert,
152-
false, false, false, false, true, ApplicationData::UserTypeExpert,
169+
false, false, false, true, false, ApplicationData::UserTypeExpert,
153170
ApplicationData::UserTypeExpert )) {
154171
return false;
155172
}
156173
if(!checkStartupAction("3", false, true, ApplicationData::UserTypeExpert,
157-
false, false, false, true, false, ApplicationData::UserTypeExpert,
174+
false, false, false, false, true, ApplicationData::UserTypeExpert,
158175
ApplicationData::UserTypeExpert )) {
159176
return false;
160177
}
161-
if(!checkStartupAction("4", true, false, ApplicationData::UserTypeExpert,
178+
if(!checkStartupAction("4", true, false, ApplicationData::UserTypeGuided,
162179
true, true, false, false, false, ApplicationData::UserTypeGuided,
163180
ApplicationData::UserTypeGuided )) {
164181
return false;
165182
}
166-
if(!checkStartupAction("5", true, true, ApplicationData::UserTypeExpert,
183+
if(!checkStartupAction("5", true, true, ApplicationData::UserTypeGuided,
167184
true, true, false, false, true, ApplicationData::UserTypeGuided,
168185
ApplicationData::UserTypeGuided )) {
169186
return false;
170187
}
171-
if(!checkStartupAction("6", false, false, ApplicationData::UserTypeExpert,
188+
if(!checkStartupAction("6", false, false, ApplicationData::UserTypeGuided,
172189
false, true, false, false, false, ApplicationData::UserTypeGuided,
173190
ApplicationData::UserTypeGuided )) {
174191
return false;
175192
}
176-
if(!checkStartupAction("7", false, true, ApplicationData::UserTypeExpert,
193+
if(!checkStartupAction("7", false, true, ApplicationData::UserTypeGuided,
177194
false, true, false, false, true, ApplicationData::UserTypeGuided,
178195
ApplicationData::UserTypeGuided )) {
179196
return false;
@@ -199,9 +216,8 @@ bool TestStartupAndBehavior::checkStartupAction(
199216
}
200217
if(!setFirstAccess){
201218
app.data()->fireUserFirstAccess();
202-
} else {
203-
app.data()->setUserType(setUserType);
204219
}
220+
app.data()->setUserType(setUserType);
205221

206222
//----
207223
StartParams startupParams;
@@ -213,7 +229,7 @@ bool TestStartupAndBehavior::checkStartupAction(
213229
}
214230
//----
215231
// check set values
216-
if(!app.data()->isUserFirstAccess() != setFirstAccess) {
232+
if(app.data()->isUserFirstAccess() != setFirstAccess) {
217233
return error(QString("id:%1 wrong first access, expected %2").arg(id).arg(setFirstAccess));
218234
}
219235
if(!setFirstAccess) {
@@ -239,6 +255,7 @@ bool TestStartupAndBehavior::checkStartupAction(
239255
expected.panelUserType = panelUserType ;
240256
//----
241257
FakeStartActionsExecutor executor(app.data());
258+
executor._data.panelUserType = setUserType ;
242259
StartActionsEngine engine( app.data(), &executor);
243260
engine.execute(startupParams);
244261
if(!checkExpectedStartupResults(&executor._data, &expected)) {

0 commit comments

Comments
 (0)