"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.
This commit is contained in:
Veloman Yunkan 2022-01-30 20:00:02 +04:00 committed by Matthieu Gautier
parent 6f3db20078
commit 901664b097
1 changed files with 27 additions and 5 deletions

View File

@ -411,11 +411,13 @@ public:
std::string expectedResponse() const; std::string expectedResponse() const;
private: private:
bool isTranslatedVersion() const;
virtual std::string pageTitle() const; virtual std::string pageTitle() const;
std::string pageCssLink() const; std::string pageCssLink() const;
std::string hiddenBookNameInput() const; std::string hiddenBookNameInput() const;
std::string searchPatternInput() const; std::string searchPatternInput() const;
std::string taskbarLinks() const; std::string taskbarLinks() const;
std::string goToWelcomePageText() const;
}; };
std::string TestContentIn404HtmlResponse::expectedResponse() const std::string TestContentIn404HtmlResponse::expectedResponse() const
@ -454,7 +456,11 @@ std::string TestContentIn404HtmlResponse::expectedResponse() const
<input type="checkbox" id="kiwix_button_show_toggle"> <input type="checkbox" id="kiwix_button_show_toggle">
<label for="kiwix_button_show_toggle"><img src="/ROOT/skin/caret.png" alt=""></label> <label for="kiwix_button_show_toggle"><img src="/ROOT/skin/caret.png" alt=""></label>
<div class="kiwix_button_cont"> <div class="kiwix_button_cont">
<a id="kiwix_serve_taskbar_library_button" title="Go to welcome page" aria-label="Go to welcome page" href="/ROOT/"><button>&#x1f3e0;</button></a> <a id="kiwix_serve_taskbar_library_button" title=")FRAG",
R"FRAG(" aria-label=")FRAG",
R"FRAG(" href="/ROOT/"><button>&#x1f3e0;</button></a>
)FRAG", )FRAG",
R"FRAG( R"FRAG(
@ -478,10 +484,14 @@ std::string TestContentIn404HtmlResponse::expectedResponse() const
+ frag[3] + frag[3]
+ searchPatternInput() + searchPatternInput()
+ frag[4] + frag[4]
+ taskbarLinks() + goToWelcomePageText()
+ frag[5] + frag[5]
+ removeEOLWhitespaceMarkers(expectedBody) + goToWelcomePageText()
+ frag[6]; + frag[6]
+ taskbarLinks()
+ frag[7]
+ expectedBody
+ frag[8];
} }
std::string TestContentIn404HtmlResponse::pageTitle() const std::string TestContentIn404HtmlResponse::pageTitle() const
@ -538,6 +548,19 @@ std::string TestContentIn404HtmlResponse::taskbarLinks() const
+ R"("><button>&#x1F3B2;</button></a>)"; + R"("><button>&#x1F3B2;</button></a>)";
} }
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 class TestContentIn400HtmlResponse : public TestContentIn404HtmlResponse
{ {
public: public:
@ -556,7 +579,6 @@ std::string TestContentIn400HtmlResponse::pageTitle() const {
: expectedPageTitle; : expectedPageTitle;
} }
} // namespace TestingOfHtmlResponses } // namespace TestingOfHtmlResponses
TEST_F(ServerTest, 404WithBodyTesting) TEST_F(ServerTest, 404WithBodyTesting)