mirror of https://github.com/kiwix/libkiwix.git
First test for a non-first page of search results
This commit is contained in:
parent
d56ccbd019
commit
21e183c2e4
|
@ -1521,6 +1521,7 @@ TEST_F(TaskbarlessServerTest, searchResults)
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string pattern;
|
std::string pattern;
|
||||||
|
int start;
|
||||||
size_t resultsPerPage;
|
size_t resultsPerPage;
|
||||||
size_t totalResultCount;
|
size_t totalResultCount;
|
||||||
size_t firstResultIndex;
|
size_t firstResultIndex;
|
||||||
|
@ -1544,7 +1545,7 @@ TEST_F(TaskbarlessServerTest, searchResults)
|
||||||
|
|
||||||
std::string url() const
|
std::string url() const
|
||||||
{
|
{
|
||||||
return makeUrl(pattern, -1, resultsPerPage);
|
return makeUrl(pattern, start, resultsPerPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string expectedHeader() const
|
std::string expectedHeader() const
|
||||||
|
@ -1629,6 +1630,7 @@ TEST_F(TaskbarlessServerTest, searchResults)
|
||||||
const TestData testData[] = {
|
const TestData testData[] = {
|
||||||
{
|
{
|
||||||
/* pattern */ "velomanyunkan",
|
/* pattern */ "velomanyunkan",
|
||||||
|
/* start */ -1,
|
||||||
/* resultsPerPage */ 0,
|
/* resultsPerPage */ 0,
|
||||||
/* totalResultCount */ 0,
|
/* totalResultCount */ 0,
|
||||||
/* firstResultIndex */ 0,
|
/* firstResultIndex */ 0,
|
||||||
|
@ -1638,6 +1640,7 @@ TEST_F(TaskbarlessServerTest, searchResults)
|
||||||
|
|
||||||
{
|
{
|
||||||
/* pattern */ "razaf",
|
/* pattern */ "razaf",
|
||||||
|
/* start */ -1,
|
||||||
/* resultsPerPage */ 0,
|
/* resultsPerPage */ 0,
|
||||||
/* totalResultCount */ 1,
|
/* totalResultCount */ 1,
|
||||||
/* firstResultIndex */ 1,
|
/* firstResultIndex */ 1,
|
||||||
|
@ -1656,6 +1659,7 @@ R"SEARCHRESULT(
|
||||||
|
|
||||||
{
|
{
|
||||||
/* pattern */ "beatles",
|
/* pattern */ "beatles",
|
||||||
|
/* start */ -1,
|
||||||
/* resultsPerPage */ 0,
|
/* resultsPerPage */ 0,
|
||||||
/* totalResultCount */ 2,
|
/* totalResultCount */ 2,
|
||||||
/* firstResultIndex */ 1,
|
/* firstResultIndex */ 1,
|
||||||
|
@ -1683,6 +1687,7 @@ R"SEARCHRESULT(
|
||||||
|
|
||||||
{
|
{
|
||||||
/* pattern */ "jazz",
|
/* pattern */ "jazz",
|
||||||
|
/* start */ -1,
|
||||||
/* resultsPerPage */ 100,
|
/* resultsPerPage */ 100,
|
||||||
/* totalResultCount */ 44,
|
/* totalResultCount */ 44,
|
||||||
/* firstResultIndex */ 1,
|
/* firstResultIndex */ 1,
|
||||||
|
@ -1692,6 +1697,7 @@ R"SEARCHRESULT(
|
||||||
|
|
||||||
{
|
{
|
||||||
/* pattern */ "jazz",
|
/* pattern */ "jazz",
|
||||||
|
/* start */ -1,
|
||||||
/* resultsPerPage */ 5,
|
/* resultsPerPage */ 5,
|
||||||
/* totalResultCount */ 44,
|
/* totalResultCount */ 44,
|
||||||
/* firstResultIndex */ 1,
|
/* firstResultIndex */ 1,
|
||||||
|
@ -1713,6 +1719,32 @@ R"SEARCHRESULT(
|
||||||
{ "▶", 40, false },
|
{ "▶", 40, false },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
/* pattern */ "jazz",
|
||||||
|
/* start */ 5,
|
||||||
|
/* resultsPerPage */ 5,
|
||||||
|
/* totalResultCount */ 44,
|
||||||
|
/* firstResultIndex */ 6,
|
||||||
|
/* results */ {
|
||||||
|
LARGE_SEARCH_RESULTS[5],
|
||||||
|
LARGE_SEARCH_RESULTS[6],
|
||||||
|
LARGE_SEARCH_RESULTS[7],
|
||||||
|
LARGE_SEARCH_RESULTS[8],
|
||||||
|
LARGE_SEARCH_RESULTS[9],
|
||||||
|
},
|
||||||
|
|
||||||
|
/* pagination */ {
|
||||||
|
{ "◀", 0, false },
|
||||||
|
{ "1", 0, false },
|
||||||
|
{ "2", 5, true },
|
||||||
|
{ "3", 10, false },
|
||||||
|
{ "4", 15, false },
|
||||||
|
{ "5", 20, false },
|
||||||
|
{ "6", 25, false },
|
||||||
|
{ "▶", 40, false },
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
for ( const auto& t : testData ) {
|
for ( const auto& t : testData ) {
|
||||||
|
|
Loading…
Reference in New Issue