From 901664b097c61659fec0ecbe1aa079adbcbcb0b5 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 30 Jan 2022 20:00:02 +0400 Subject: [PATCH] "Go to welcome page" in taskbar isn't translated The (failing) tests now demonstrate that some text in the taskbar is not translated. Will fix in the next commit. --- test/server.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/test/server.cpp b/test/server.cpp index 65c1376a8..e82dd676e 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -411,11 +411,13 @@ public: std::string expectedResponse() const; private: + bool isTranslatedVersion() const; virtual std::string pageTitle() const; std::string pageCssLink() const; std::string hiddenBookNameInput() const; std::string searchPatternInput() const; std::string taskbarLinks() const; + std::string goToWelcomePageText() const; }; std::string TestContentIn404HtmlResponse::expectedResponse() const @@ -454,7 +456,11 @@ std::string TestContentIn404HtmlResponse::expectedResponse() const
- + )FRAG", R"FRAG( @@ -478,10 +484,14 @@ std::string TestContentIn404HtmlResponse::expectedResponse() const + frag[3] + searchPatternInput() + frag[4] - + taskbarLinks() + + goToWelcomePageText() + frag[5] - + removeEOLWhitespaceMarkers(expectedBody) - + frag[6]; + + goToWelcomePageText() + + frag[6] + + taskbarLinks() + + frag[7] + + expectedBody + + frag[8]; } std::string TestContentIn404HtmlResponse::pageTitle() const @@ -538,6 +548,19 @@ std::string TestContentIn404HtmlResponse::taskbarLinks() const + R"(">)"; } +bool TestContentIn404HtmlResponse::isTranslatedVersion() const +{ + return url.find("userlang=hy") != std::string::npos; +} + +std::string TestContentIn404HtmlResponse::goToWelcomePageText() const +{ + return isTranslatedVersion() + ? "Գրադարանի էջ" + : "Go to welcome page"; +} + + class TestContentIn400HtmlResponse : public TestContentIn404HtmlResponse { public: @@ -556,7 +579,6 @@ std::string TestContentIn400HtmlResponse::pageTitle() const { : expectedPageTitle; } - } // namespace TestingOfHtmlResponses TEST_F(ServerTest, 404WithBodyTesting)