mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Fix unit tests after crengine update (#3993)
This commit is contained in:
@@ -146,7 +146,7 @@ describe("Readerfooter module", function()
|
||||
local timeinfo = footer.textGeneratorMap.time()
|
||||
local page_count = readerui.document:getPageCount()
|
||||
-- stats has not been initialized here, so we get na TB and TC
|
||||
assert.are.same('1 / '..page_count..' | '..timeinfo..' | => 1 | B:0% | R:0% | TB: na | TC: na',
|
||||
assert.are.same('1 / '..page_count..' | '..timeinfo..' | => 0 | B:0% | R:1% | TB: na | TC: na',
|
||||
footer.footer_text.text)
|
||||
end)
|
||||
|
||||
@@ -295,8 +295,8 @@ describe("Readerfooter module", function()
|
||||
assert.are.same(365, footer.text_width)
|
||||
|
||||
footer:onPageUpdate(100)
|
||||
assert.are.same(191, footer.progress_bar.width)
|
||||
assert.are.same(389, footer.text_width)
|
||||
assert.are.same(183, footer.progress_bar.width)
|
||||
assert.are.same(397, footer.text_width)
|
||||
end)
|
||||
|
||||
it("should support chapter markers", function()
|
||||
@@ -545,7 +545,7 @@ describe("Readerfooter module", function()
|
||||
assert.is.same(0, footer.text_width)
|
||||
|
||||
tapFooterMenu(fake_menu, "Progress percentage")
|
||||
assert.are.same('R:0%', footer.footer_text.text)
|
||||
assert.are.same('R:1%', footer.footer_text.text)
|
||||
assert.is.same(false, footer.has_no_mode)
|
||||
assert.is.same(footer.footer_text:getSize().w + footer.text_left_margin,
|
||||
footer.text_width)
|
||||
|
||||
@@ -65,12 +65,16 @@ describe("Readersearch module", function()
|
||||
end
|
||||
end)
|
||||
it("should find the last occurrence", function()
|
||||
-- local logger = require("logger")
|
||||
-- logger.info("nb of pages", doc:getPageCount())
|
||||
-- 20180602: currently 200 pages (was 202 before)
|
||||
for i = 100, 180, 10 do
|
||||
rolling:onGotoPage(i)
|
||||
local words = search:searchFromEnd("Verona")
|
||||
assert.truthy(words)
|
||||
local pageno = doc:getPageFromXPointer(words[1].start)
|
||||
assert.truthy(pageno > 200)
|
||||
-- logger.info("last match on page", pageno)
|
||||
assert.truthy(pageno > 195)
|
||||
end
|
||||
for i = 230, 235, 1 do
|
||||
rolling:onGotoPage(i)
|
||||
|
||||
@@ -68,7 +68,7 @@ describe("Readertoc module", function()
|
||||
end)
|
||||
it("should get page left of chapter", function()
|
||||
assert.truthy(toc:getChapterPagesLeft(10, 0) > 10)
|
||||
assert.truthy(toc:getChapterPagesLeft(102, 0) > 10)
|
||||
assert.truthy(toc:getChapterPagesLeft(100, 0) > 10)
|
||||
assert.are.same(nil, toc:getChapterPagesLeft(200, 0))
|
||||
end)
|
||||
it("should get page done of chapter", function()
|
||||
|
||||
Reference in New Issue
Block a user