MCPcopy Create free account
hub / github.com/axmolengine/axmol / traverseTestSuite

Method traverseTestSuite

tests/cpp-tests/Source/controller.cpp:248–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246 }
247
248 Coroutine TestController::traverseTestSuite(TestSuite* testSuite)
249 {
250 auto scheduler = _director->getScheduler();
251 int testIndex = 0;
252 float testCaseDuration = 0.0f;
253 _logIndentation += LOG_INDENTATION;
254 AXLOGD("{}{}Begin traverse TestSuite:{}", LOG_TAG, _logIndentation.c_str(), testSuite->getTestName().c_str());
255
256 _logIndentation += LOG_INDENTATION;
257 testSuite->_currTestIndex = -1;
258
259 auto logIndentation = _logIndentation;
260 for (auto&& callback : testSuite->_testCallbacks)
261 {
262 auto testName = testSuite->_childTestNames[testIndex++];
263
264 Scene* testScene = nullptr;
265 TestCase* testCase = nullptr;
266 TransitionScene* transitionScene = nullptr;
267
268 if (_stopAutoTest)
269 break;
270
271 while (_isRunInBackground)
272 {
273 AXLOGD("_director is paused");
274 co_yield DelayTime::create(0.5);
275 }
276 if (_stopAutoTest)
277 break;
278 AXLOGD("{}{}Run test:{}.", LOG_TAG, logIndentation, testName);
279
280 auto scene = callback();
281 if (_stopAutoTest)
282 break;
283
284 if (scene)
285 {
286 transitionScene = dynamic_cast<TransitionScene*>(scene);
287 if (transitionScene)
288 {
289 testCase = (TestCase*)transitionScene->getInScene();
290 testCaseDuration = transitionScene->getDuration() + 0.5f;
291
292 }
293 else
294 {
295 testCase = (TestCase*)scene;
296 testCaseDuration = testCase->getDuration();
297 }
298 testSuite->_currTestIndex++;
299 testCase->setTestSuite(testSuite);
300 testCase->setTestCaseName(testName);
301 _director->replaceScene(scene);
302
303 testScene = scene;
304
305 co_yield DelayTime::create(testCaseDuration);

Callers

nothing calls this directly

Calls 11

createFunction · 0.85
getTestNameMethod · 0.80
setTestSuiteMethod · 0.80
setTestCaseNameMethod · 0.80
replaceSceneMethod · 0.80
c_strMethod · 0.45
getDurationMethod · 0.45
runThisTestMethod · 0.45
releaseMethod · 0.45
eraseMethod · 0.45
rfindMethod · 0.45

Tested by

no test coverage detected