TestNavigator.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. * This source file is part of RmlUi, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://github.com/mikke89/RmlUi
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. * Copyright (c) 2019-2023 The RmlUi Team, and contributors
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. *
  27. */
  28. #include "TestNavigator.h"
  29. #include "CaptureScreen.h"
  30. #include "TestConfig.h"
  31. #include "TestSuite.h"
  32. #include "TestViewer.h"
  33. #include <RmlUi/Core/Context.h>
  34. #include <RmlUi/Core/Element.h>
  35. #include <RmlUi/Core/ElementDocument.h>
  36. #include <RmlUi/Core/Math.h>
  37. #include <Shell.h>
  38. #include <cstdio>
  39. // When capturing frames it seems we need to wait at least an extra frame for the newly submitted
  40. // render to be read back out. If we don't wait, we end up saving a screenshot of the previous test.
  41. constexpr int iteration_wait_frame_count = 2;
  42. TestNavigator::TestNavigator(Rml::RenderInterface* render_interface, Rml::Context* context, TestViewer* viewer, TestSuiteList _test_suites,
  43. int start_suite, int start_case) :
  44. render_interface(render_interface),
  45. context(context), viewer(viewer), test_suites(std::move(_test_suites))
  46. {
  47. RMLUI_ASSERT(context);
  48. RMLUI_ASSERTMSG(!test_suites.empty(), "At least one test suite is required.");
  49. context->GetRootElement()->AddEventListener(Rml::EventId::Keydown, this, true);
  50. context->GetRootElement()->AddEventListener(Rml::EventId::Keydown, this);
  51. context->GetRootElement()->AddEventListener(Rml::EventId::Textinput, this);
  52. context->GetRootElement()->AddEventListener(Rml::EventId::Change, this);
  53. suite_index = Rml::Math::Clamp(start_suite, 0, (int)test_suites.size() - 1);
  54. if (start_case > 0)
  55. CurrentSuite().SetIndex(start_case);
  56. LoadActiveTest();
  57. }
  58. TestNavigator::~TestNavigator()
  59. {
  60. context->GetRootElement()->RemoveEventListener(Rml::EventId::Keydown, this, true);
  61. context->GetRootElement()->RemoveEventListener(Rml::EventId::Keydown, this);
  62. context->GetRootElement()->RemoveEventListener(Rml::EventId::Textinput, this);
  63. context->GetRootElement()->RemoveEventListener(Rml::EventId::Change, this);
  64. ReleaseTextureGeometry(render_interface, reference_geometry);
  65. }
  66. void TestNavigator::Update()
  67. {
  68. if (iteration_state != IterationState::None)
  69. {
  70. RMLUI_ASSERT(iteration_index >= 0);
  71. // Capture test document screenshots iteratively every nth frame.
  72. if (iteration_wait_frames > 0)
  73. {
  74. iteration_wait_frames -= 1;
  75. }
  76. else
  77. {
  78. RMLUI_ASSERT(iteration_index < CurrentSuite().GetNumTests());
  79. iteration_wait_frames = iteration_wait_frame_count;
  80. if (iteration_state == IterationState::Capture)
  81. {
  82. if (!CaptureCurrentView())
  83. {
  84. StopTestSuiteIteration();
  85. return;
  86. }
  87. }
  88. else if (iteration_state == IterationState::Comparison)
  89. {
  90. RMLUI_ASSERT((int)comparison_results.size() == CurrentSuite().GetNumTests());
  91. int test_index = CurrentSuite().GetIndex();
  92. comparison_results[test_index] = CompareCurrentView();
  93. }
  94. iteration_index += 1;
  95. if (CurrentSuite().Next())
  96. LoadActiveTest();
  97. else
  98. StopTestSuiteIteration();
  99. }
  100. }
  101. }
  102. void TestNavigator::Render()
  103. {
  104. if (show_reference && reference_geometry.texture_handle)
  105. {
  106. render_interface->RenderGeometry(reference_geometry.vertices, 4, reference_geometry.indices, 6, reference_geometry.texture_handle,
  107. Rml::Vector2f(0, 0));
  108. }
  109. }
  110. void TestNavigator::ProcessEvent(Rml::Event& event)
  111. {
  112. // Keydown events in capture phase to override text input
  113. if (event == Rml::EventId::Keydown && event.GetPhase() == Rml::EventPhase::Capture)
  114. {
  115. const auto key_identifier = (Rml::Input::KeyIdentifier)event.GetParameter<int>("key_identifier", 0);
  116. const bool key_ctrl = event.GetParameter<bool>("ctrl_key", false);
  117. const bool key_shift = event.GetParameter<bool>("shift_key", false);
  118. Rml::Element* element_filter_input = event.GetCurrentElement()->GetElementById("filterinput");
  119. RMLUI_ASSERT(element_filter_input);
  120. if (key_identifier == Rml::Input::KI_F5)
  121. {
  122. if (key_ctrl && key_shift)
  123. StartTestSuiteIteration(IterationState::Comparison);
  124. else
  125. {
  126. ComparisonResult result = CompareCurrentView();
  127. const Rml::String compare_path = GetCompareInputDirectory() + '/' + GetImageFilenameFromCurrentTest();
  128. if (result.success)
  129. {
  130. if (result.is_equal)
  131. {
  132. Rml::Log::Message(Rml::Log::LT_INFO, "%s compares EQUAL to the reference image %s.", CurrentSuite().GetFilename().c_str(),
  133. compare_path.c_str());
  134. }
  135. else
  136. {
  137. Rml::Log::Message(Rml::Log::LT_INFO, "%s compares NOT EQUAL to the reference image %s.\nSee diff image written to %s.",
  138. CurrentSuite().GetFilename().c_str(), compare_path.c_str(), GetCaptureOutputDirectory().c_str());
  139. }
  140. if (!result.error_msg.empty())
  141. Rml::Log::Message(Rml::Log::LT_ERROR, "%s", result.error_msg.c_str());
  142. }
  143. else
  144. {
  145. Rml::Log::Message(Rml::Log::LT_ERROR, "Comparison of %s failed.\n%s", CurrentSuite().GetFilename().c_str(),
  146. result.error_msg.c_str());
  147. }
  148. }
  149. }
  150. else if (key_identifier == Rml::Input::KI_F7)
  151. {
  152. if (key_ctrl && key_shift)
  153. {
  154. StartTestSuiteIteration(IterationState::Capture);
  155. }
  156. else
  157. {
  158. const Rml::String filepath = GetCaptureOutputDirectory() + '/' + GetImageFilenameFromCurrentTest();
  159. if (CaptureCurrentView())
  160. Rml::Log::Message(Rml::Log::LT_INFO, "Succesfully captured and saved screenshot to %s", filepath.c_str());
  161. else
  162. Rml::Log::Message(Rml::Log::LT_ERROR, "Could not capture screenshot to %s", filepath.c_str());
  163. }
  164. }
  165. else if (key_identifier == Rml::Input::KI_F1)
  166. {
  167. viewer->ShowHelp(!viewer->IsHelpVisible());
  168. }
  169. else if (key_identifier == Rml::Input::KI_F && key_ctrl)
  170. {
  171. element_filter_input->Focus();
  172. context->ProcessKeyDown(Rml::Input::KI_A, Rml::Input::KeyModifier::KM_CTRL);
  173. context->ProcessKeyUp(Rml::Input::KI_A, Rml::Input::KeyModifier::KM_CTRL);
  174. }
  175. else if (key_identifier == Rml::Input::KI_R && key_ctrl)
  176. {
  177. LoadActiveTest(true);
  178. }
  179. else if (key_identifier == Rml::Input::KI_S && key_ctrl)
  180. {
  181. if (source_state == SourceType::None)
  182. {
  183. source_state = (key_shift ? SourceType::Reference : SourceType::Test);
  184. }
  185. else
  186. {
  187. if (key_shift)
  188. source_state = (source_state == SourceType::Reference ? SourceType::Test : SourceType::Reference);
  189. else
  190. source_state = SourceType::None;
  191. }
  192. viewer->ShowSource(source_state);
  193. ShowReference(false, false);
  194. }
  195. else if (key_identifier == Rml::Input::KI_Q && key_ctrl)
  196. {
  197. ShowReference(!show_reference, false);
  198. }
  199. else if (key_identifier == Rml::Input::KI_ESCAPE)
  200. {
  201. if (iteration_state != IterationState::None)
  202. {
  203. StopTestSuiteIteration();
  204. }
  205. else if (viewer->IsHelpVisible())
  206. {
  207. viewer->ShowHelp(false);
  208. }
  209. else if (source_state != SourceType::None)
  210. {
  211. source_state = SourceType::None;
  212. viewer->ShowSource(source_state);
  213. }
  214. else if (element_filter_input->IsPseudoClassSet("focus"))
  215. {
  216. element_filter_input->Blur();
  217. }
  218. else if (viewer->IsNavigationLocked())
  219. {
  220. element_filter_input->GetOwnerDocument()->Focus();
  221. }
  222. else if (goto_index >= 0)
  223. {
  224. goto_index = -1;
  225. UpdateGoToText();
  226. }
  227. }
  228. else if (key_identifier == Rml::Input::KI_RETURN || key_identifier == Rml::Input::KI_NUMPADENTER)
  229. {
  230. element_filter_input->Blur();
  231. }
  232. else if (key_identifier == Rml::Input::KI_G && key_ctrl)
  233. {
  234. if (goto_index < 0)
  235. {
  236. goto_index = 0;
  237. UpdateGoToText();
  238. element_filter_input->Blur();
  239. }
  240. }
  241. }
  242. // Keydown events in target/bubble phase ignored when focusing on input.
  243. if (event == Rml::EventId::Keydown && event.GetPhase() != Rml::EventPhase::Capture && !viewer->IsNavigationLocked())
  244. {
  245. const auto key_identifier = (Rml::Input::KeyIdentifier)event.GetParameter<int>("key_identifier", 0);
  246. if (key_identifier == Rml::Input::KI_LEFT)
  247. {
  248. if (CurrentSuite().Previous())
  249. {
  250. LoadActiveTest();
  251. }
  252. }
  253. else if (key_identifier == Rml::Input::KI_RIGHT)
  254. {
  255. if (CurrentSuite().Next())
  256. {
  257. LoadActiveTest();
  258. }
  259. }
  260. else if (key_identifier == Rml::Input::KI_UP)
  261. {
  262. const Rml::String& filter = CurrentSuite().GetFilter();
  263. int new_index = std::max(0, suite_index - 1);
  264. if (new_index != suite_index)
  265. {
  266. suite_index = new_index;
  267. CurrentSuite().SetFilter(filter);
  268. LoadActiveTest();
  269. }
  270. }
  271. else if (key_identifier == Rml::Input::KI_DOWN)
  272. {
  273. const Rml::String& filter = CurrentSuite().GetFilter();
  274. int new_index = std::min((int)test_suites.size() - 1, suite_index + 1);
  275. if (new_index != suite_index)
  276. {
  277. suite_index = new_index;
  278. CurrentSuite().SetFilter(filter);
  279. LoadActiveTest();
  280. }
  281. }
  282. else if (key_identifier == Rml::Input::KI_HOME)
  283. {
  284. CurrentSuite().SetIndex(0, TestSuite::Direction::Forward);
  285. LoadActiveTest();
  286. }
  287. else if (key_identifier == Rml::Input::KI_END)
  288. {
  289. CurrentSuite().SetIndex(CurrentSuite().GetNumTests() - 1, TestSuite::Direction::Backward);
  290. LoadActiveTest();
  291. }
  292. else if (goto_index >= 0 && key_identifier == Rml::Input::KI_BACK)
  293. {
  294. if (goto_index <= 0)
  295. goto_index = -1;
  296. else
  297. goto_index = goto_index / 10;
  298. UpdateGoToText();
  299. }
  300. }
  301. if (event == Rml::EventId::Textinput && goto_index >= 0)
  302. {
  303. const Rml::String text = event.GetParameter<Rml::String>("text", "");
  304. for (const char c : text)
  305. {
  306. if (c >= '0' && c <= '9')
  307. {
  308. goto_index = goto_index * 10 + int(c - '0');
  309. UpdateGoToText();
  310. }
  311. else if (goto_index >= 0 && c == '\n')
  312. {
  313. bool out_of_bounds = false;
  314. if (goto_index > 0)
  315. {
  316. if (CurrentSuite().SetIndex(goto_index - 1))
  317. LoadActiveTest();
  318. else
  319. out_of_bounds = true;
  320. }
  321. goto_index = -1;
  322. UpdateGoToText(out_of_bounds);
  323. }
  324. }
  325. }
  326. if (event == Rml::EventId::Change)
  327. {
  328. Rml::Element* element = event.GetTargetElement();
  329. if (element->GetId() == "filterinput")
  330. {
  331. CurrentSuite().SetFilter(event.GetParameter<Rml::String>("value", ""));
  332. LoadActiveTest();
  333. }
  334. }
  335. }
  336. void TestNavigator::LoadActiveTest(bool keep_scroll_position)
  337. {
  338. const TestSuite& suite = CurrentSuite();
  339. viewer->LoadTest(suite.GetDirectory(), suite.GetFilename(), suite.GetIndex(), suite.GetNumTests(), suite.GetFilterIndex(),
  340. suite.GetNumFilteredTests(), suite_index, (int)test_suites.size(), keep_scroll_position);
  341. viewer->ShowSource(source_state);
  342. ShowReference(false, true);
  343. UpdateGoToText();
  344. }
  345. Rml::String TestNavigator::GetImageFilenameFromCurrentTest()
  346. {
  347. const Rml::String& filename = CurrentSuite().GetFilename();
  348. return filename.substr(0, filename.rfind('.')) + ".png";
  349. }
  350. ComparisonResult TestNavigator::CompareCurrentView()
  351. {
  352. const Rml::String filename = GetImageFilenameFromCurrentTest();
  353. ComparisonResult result = CompareScreenToPreviousCapture(render_interface, filename, nullptr);
  354. return result;
  355. }
  356. bool TestNavigator::CaptureCurrentView()
  357. {
  358. const Rml::String filename = GetImageFilenameFromCurrentTest();
  359. bool result = CaptureScreenshot(filename, 1060);
  360. return result;
  361. }
  362. void TestNavigator::StartTestSuiteIteration(IterationState new_iteration_state)
  363. {
  364. if (iteration_state != IterationState::None || new_iteration_state == IterationState::None)
  365. return;
  366. source_state = SourceType::None;
  367. TestSuite& suite = CurrentSuite();
  368. if (new_iteration_state == IterationState::Comparison)
  369. {
  370. comparison_results.clear();
  371. comparison_results.resize(suite.GetNumTests());
  372. }
  373. iteration_initial_index = suite.GetIndex();
  374. iteration_wait_frames = iteration_wait_frame_count;
  375. iteration_state = new_iteration_state;
  376. iteration_index = 0;
  377. suite.SetIndex(iteration_index, TestSuite::Direction::Forward);
  378. LoadActiveTest();
  379. }
  380. static bool SaveFile(const Rml::String& file_path, const Rml::String& contents)
  381. {
  382. std::FILE* file = std::fopen(file_path.c_str(), "wt");
  383. if (!file)
  384. return false;
  385. std::fputs(contents.c_str(), file);
  386. std::fclose(file);
  387. return true;
  388. }
  389. void TestNavigator::StopTestSuiteIteration()
  390. {
  391. if (iteration_state == IterationState::None)
  392. return;
  393. const Rml::String output_directory = GetCaptureOutputDirectory();
  394. TestSuite& suite = CurrentSuite();
  395. const int num_tests = suite.GetNumTests();
  396. const int num_filtered_tests = suite.GetNumFilteredTests();
  397. if (iteration_state == IterationState::Capture)
  398. {
  399. if (iteration_index == num_tests)
  400. {
  401. Rml::Log::Message(Rml::Log::LT_INFO, "Successfully captured %d document screenshots to directory: %s", iteration_index,
  402. output_directory.c_str());
  403. }
  404. else if (iteration_index == num_filtered_tests)
  405. {
  406. Rml::Log::Message(Rml::Log::LT_INFO, "Successfully captured %d document screenshots (filtered out of %d total tests) to directory: %s",
  407. iteration_index, num_tests, output_directory.c_str());
  408. }
  409. else
  410. {
  411. Rml::Log::Message(Rml::Log::LT_ERROR, "Test suite capture aborted after %d of %d test(s). Output directory: %s", iteration_index,
  412. num_tests, output_directory.c_str());
  413. }
  414. }
  415. else if (iteration_state == IterationState::Comparison)
  416. {
  417. RMLUI_ASSERT(num_tests == (int)comparison_results.size());
  418. // Indices
  419. Rml::Vector<int> equal;
  420. Rml::Vector<int> not_equal;
  421. Rml::Vector<int> failed;
  422. Rml::Vector<int> skipped;
  423. for (int i = 0; i < (int)comparison_results.size(); i++)
  424. {
  425. const ComparisonResult& comparison = comparison_results[i];
  426. if (comparison.skipped)
  427. skipped.push_back(i);
  428. else if (!comparison.success)
  429. failed.push_back(i);
  430. else if (comparison.is_equal)
  431. equal.push_back(i);
  432. else
  433. not_equal.push_back(i);
  434. }
  435. Rml::String summary = Rml::CreateString(256, " Total tests: %d\n Not equal: %d\n Failed: %d\n Skipped: %d\n Equal: %d", num_tests,
  436. (int)not_equal.size(), (int)failed.size(), (int)skipped.size(), (int)equal.size());
  437. if (!suite.GetFilter().empty())
  438. summary += "\n Filter applied: " + suite.GetFilter();
  439. if (iteration_index == num_tests)
  440. {
  441. Rml::Log::Message(Rml::Log::LT_INFO, "Compared all test documents to their screenshot captures.\n%s", summary.c_str());
  442. }
  443. else if (iteration_index == num_filtered_tests)
  444. {
  445. Rml::Log::Message(Rml::Log::LT_INFO, "Compared all filtered test documents to their screenshot captures.\n%s", summary.c_str());
  446. }
  447. else
  448. {
  449. Rml::Log::Message(Rml::Log::LT_ERROR, "Test suite comparison aborted after %d of %d test(s).\n%s", iteration_index, num_tests,
  450. summary.c_str());
  451. }
  452. Rml::String log;
  453. log.reserve(comparison_results.size() * 100);
  454. log += "RmlUi VisualTests comparison log output\n---------------------------------------\n\n" + summary;
  455. log += "\n\nNot Equal:\n";
  456. if (!not_equal.empty())
  457. log += "Percentages are similarity scores. Difference images written to " + GetCaptureOutputDirectory() + "/*-diff.png\n\n";
  458. for (int i : not_equal)
  459. {
  460. suite.SetIndex(i);
  461. log += Rml::CreateString(256, "%5d %5.1f%% %s\n", i + 1, comparison_results[i].similarity_score * 100.0, suite.GetFilename().c_str());
  462. if (!comparison_results[i].error_msg.empty())
  463. log += " " + comparison_results[i].error_msg + "\n";
  464. }
  465. log += "\nFailed:\n";
  466. for (int i : failed)
  467. {
  468. suite.SetIndex(i);
  469. log += Rml::CreateString(512, "%5d %s\n", i + 1, suite.GetFilename().c_str());
  470. log += " " + comparison_results[i].error_msg + "\n";
  471. }
  472. log += "\nSkipped:\n";
  473. for (int i : skipped)
  474. {
  475. suite.SetIndex(i);
  476. log += Rml::CreateString(256, "%5d %s\n", i + 1, suite.GetFilename().c_str());
  477. }
  478. log += "\nEqual:\n";
  479. for (int i : equal)
  480. {
  481. suite.SetIndex(i);
  482. log += Rml::CreateString(256, "%5d %s\n", i + 1, suite.GetFilename().c_str());
  483. }
  484. const Rml::String log_path = GetCaptureOutputDirectory() + "/comparison.log";
  485. bool save_result = SaveFile(log_path, log);
  486. if (save_result && failed.empty())
  487. Rml::Log::Message(Rml::Log::LT_INFO, "Comparison log output written to %s", log_path.c_str());
  488. else if (save_result && !failed.empty())
  489. Rml::Log::Message(Rml::Log::LT_ERROR, "Comparison log output written to %s.\nSome comparisons failed, see log output for details.",
  490. log_path.c_str());
  491. else
  492. Rml::Log::Message(Rml::Log::LT_ERROR, "Failed writing comparison log output to file %s", log_path.c_str());
  493. }
  494. iteration_index = -1;
  495. iteration_initial_index = -1;
  496. iteration_wait_frames = -1;
  497. iteration_state = IterationState::None;
  498. suite.SetIndex(iteration_initial_index);
  499. LoadActiveTest();
  500. }
  501. void TestNavigator::UpdateGoToText(bool out_of_bounds)
  502. {
  503. if (out_of_bounds)
  504. viewer->SetGoToText("Go To out of bounds");
  505. else if (goto_index > 0)
  506. viewer->SetGoToText(Rml::CreateString(64, "Go To: %d", goto_index));
  507. else if (goto_index == 0)
  508. viewer->SetGoToText("Go To:");
  509. else if (iteration_state == IterationState::Capture)
  510. viewer->SetGoToText("Capturing all tests");
  511. else if (iteration_state == IterationState::Comparison)
  512. viewer->SetGoToText("Comparing all tests");
  513. else if (show_reference)
  514. viewer->SetGoToText(Rml::CreateString(100, "Showing reference capture (%.1f%% similar)", reference_comparison.similarity_score * 100.));
  515. else
  516. viewer->SetGoToText("Press 'F1' for keyboard shortcuts.");
  517. }
  518. void TestNavigator::ShowReference(bool show, bool clear)
  519. {
  520. if (clear)
  521. {
  522. ReleaseTextureGeometry(render_interface, reference_geometry);
  523. reference_comparison = {};
  524. }
  525. Rml::String error_msg;
  526. if (show && !reference_geometry.texture_handle)
  527. {
  528. reference_comparison = CompareScreenToPreviousCapture(render_interface, GetImageFilenameFromCurrentTest(), &reference_geometry);
  529. if (!reference_comparison.success)
  530. error_msg = reference_comparison.error_msg;
  531. }
  532. show_reference = (show && reference_comparison.success && !reference_comparison.is_equal);
  533. viewer->SetAttention(show_reference);
  534. if (!error_msg.empty())
  535. viewer->SetGoToText(error_msg);
  536. else if (reference_comparison.is_equal)
  537. viewer->SetGoToText("EQUAL to reference capture");
  538. else
  539. UpdateGoToText();
  540. }