mirror of https://github.com/kiwix/libkiwix.git
Testing the request for an out-of-bounds page
This commit is contained in:
parent
8e7658bb10
commit
1a8d874a2c
|
@ -1645,7 +1645,7 @@ TEST_F(TaskbarlessServerTest, searchResults)
|
|||
</b>
|
||||
)";
|
||||
|
||||
const size_t lastResultIndex = firstResultIndex + results.size() - 1;
|
||||
const size_t lastResultIndex = std::min(totalResultCount, firstResultIndex + results.size() - 1);
|
||||
header = replace(header, "FIRSTRESULT", to_string(firstResultIndex));
|
||||
header = replace(header, "LASTRESULT", to_string(lastResultIndex));
|
||||
header = replace(header, "RESULTCOUNT", to_string(totalResultCount));
|
||||
|
@ -2073,6 +2073,26 @@ R"SEARCHRESULT(
|
|||
{ "▶", 40, false },
|
||||
}
|
||||
},
|
||||
|
||||
// This test-point only documents how the current implementation
|
||||
// works, not how it should work!
|
||||
{
|
||||
/* pattern */ "jazz",
|
||||
/* start */ 45,
|
||||
/* resultsPerPage */ 5,
|
||||
/* totalResultCount */ 44,
|
||||
/* firstResultIndex */ 46,
|
||||
/* results */ {},
|
||||
|
||||
/* pagination */ {
|
||||
{ "◀", 0, false },
|
||||
{ "6", 25, false },
|
||||
{ "7", 30, false },
|
||||
{ "8", 35, false },
|
||||
{ "9", 40, false },
|
||||
{ "▶", 40, false },
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
for ( const auto& t : testData ) {
|
||||
|
|
Loading…
Reference in New Issue