Test %d of %d.
%s", document->GetTitle().c_str(), current_id + 1, (int)test_suite.files.size(), current_filename.c_str());
if (!reference_file.empty())
{
if (document_match)
rml_description += "
" + reference_file;
else
rml_description += "
(X " + reference_file + ")";
}
rml_description += "
"; for (const LinkItem& item : link_list) { if (item.rel == "match") continue; rml_description += "" + item.rel + " "; } rml_description += "
"; } for (const MetaItem& item : meta_list) { rml_description += "" + item.content + "
"; } Element* description_content = document_description->GetElementById("content"); REQUIRE(description_content); description_content->SetInnerRML(rml_description); Element* description_test_suite = document_description->GetElementById("test_suite"); REQUIRE(description_test_suite); description_test_suite->SetInnerRML(CreateString(64, "Test suite %d of %d", current_test_suite + 1, (int)test_suites.size())); Element* description_goto = document_description->GetElementById("goto"); REQUIRE(description_goto); description_goto->SetInnerRML(""); goto_id = 0; CloseSource(); } void Window::ProcessEvent(Rml::Event& event) { if (event == EventId::Keydown) { auto key_identifier = (Rml::Input::KeyIdentifier)event.GetParameter< int >("key_identifier", 0); bool key_ctrl = event.GetParameter< bool >("ctrl_key", false); bool key_shift = event.GetParameter< bool >("shift_key", false); if (key_identifier == Rml::Input::KI_LEFT) { current_id = std::max(0, current_id - 1); ReloadDocument(); } else if (key_identifier == Rml::Input::KI_RIGHT) { current_id = std::min((int)GetCurrentTestSuite().files.size() - 1, current_id + 1); ReloadDocument(); } else if (key_identifier == Rml::Input::KI_UP) { current_test_suite = std::max(0, current_test_suite - 1); current_id = 0; ReloadDocument(); } else if (key_identifier == Rml::Input::KI_DOWN) { current_test_suite = std::min((int)test_suites.size() - 1, current_test_suite + 1); current_id = 0; ReloadDocument(); } else if (key_identifier == Rml::Input::KI_S) { if (document_source->IsVisible()) { if (key_shift) SwitchSource(); else CloseSource(); } else { viewing_reference_source = key_shift; OpenSource(); } } else if (key_identifier == Rml::Input::KI_ESCAPE) { if (document_source->IsVisible()) CloseSource(); else TestsShell::RequestExit(); } else if (key_identifier == Rml::Input::KI_C && key_ctrl) { if (key_shift) Shell::SetClipboardText(GetCurrentTestSuite().directory + '\\' + reference_file); else Shell::SetClipboardText(GetCurrentPath()); } else if (key_identifier == Rml::Input::KI_HOME) { current_id = 0; ReloadDocument(); } else if (key_identifier == Rml::Input::KI_END) { current_id = (int)GetCurrentTestSuite().files.size() - 1; ReloadDocument(); } else if (goto_id >= 0 && key_identifier == Rml::Input::KI_BACK) { if (goto_id <= 0) { goto_id = -1; document_description->GetElementById("goto")->SetInnerRML(""); } else { goto_id = goto_id / 10; document_description->GetElementById("goto")->SetInnerRML(CreateString(64, "Go To: %d", goto_id)); } } } if (event == EventId::Textinput) { const String text = event.GetParameter< String >("text", ""); for (const char c : text) { if (c >= '0' && c <= '9') { if (goto_id < 0) goto_id = 0; goto_id = goto_id * 10 + int(c - '0'); document_description->GetElementById("goto")->SetInnerRML(CreateString(64, "Go To: %d", goto_id)); } else if (goto_id >= 0 && c == '\n') { if (goto_id > 0 && goto_id <= (int)GetCurrentTestSuite().files.size()) { current_id = goto_id - 1; ReloadDocument(); } else { document_description->GetElementById("goto")->SetInnerRML("Error: Go To out of bounds."); } goto_id = -1; } } } }