mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
accommodation of EPUB spec for new crengine
This commit is contained in:
@@ -101,9 +101,10 @@ describe("Readerfooter module", function()
|
||||
local footer = readerui.view.footer
|
||||
footer:onPageUpdate(1)
|
||||
footer:updateFooter()
|
||||
timeinfo = footer:getTimeInfo()
|
||||
local timeinfo = footer:getTimeInfo()
|
||||
local page_count = readerui.document:getPageCount()
|
||||
-- stats has not been initialized here, so we get na TB and TC
|
||||
assert.are.same('B:0% | '..timeinfo..' | 1 / 204 | => 1 | R:0% | TB: na | TC: na',
|
||||
assert.are.same('B:0% | '..timeinfo..' | 1 / '..page_count..' | => 1 | R:0% | TB: na | TC: na',
|
||||
footer.progress_text.text)
|
||||
end)
|
||||
|
||||
@@ -116,7 +117,7 @@ describe("Readerfooter module", function()
|
||||
document = DocumentRegistry:openDocument(sample_pdf),
|
||||
}
|
||||
readerui.view.footer:updateFooter()
|
||||
timeinfo = readerui.view.footer:getTimeInfo()
|
||||
local timeinfo = readerui.view.footer:getTimeInfo()
|
||||
assert.are.same('B:0% | '..timeinfo..' | 1 / 2 | => 1 | R:50% | TB: na | TC: na',
|
||||
readerui.view.footer.progress_text.text)
|
||||
end)
|
||||
@@ -132,7 +133,7 @@ describe("Readerfooter module", function()
|
||||
local footer = readerui.view.footer
|
||||
footer:resetLayout()
|
||||
footer:updateFooter()
|
||||
timeinfo = readerui.view.footer:getTimeInfo()
|
||||
local timeinfo = readerui.view.footer:getTimeInfo()
|
||||
assert.are.same('B:0% | '..timeinfo..' | 1 / 2 | => 1 | R:50% | TB: na | TC: na',
|
||||
footer.progress_text.text)
|
||||
footer.mode = 1
|
||||
@@ -252,11 +253,9 @@ describe("Readerfooter module", function()
|
||||
}
|
||||
local footer = readerui.view.footer
|
||||
footer:onPageUpdate(1)
|
||||
assert.are.same({
|
||||
3, 6, 9, 10, 26, 33, 40, 47, 57, 58, 61, 73, 79, 94, 99, 102, 115,
|
||||
123, 133, 136, 151, 159, 163, 167, 170, 179, 184, 186,
|
||||
}, footer.progress_bar.ticks)
|
||||
assert.are.same(204, footer.progress_bar.last)
|
||||
local page_count = readerui.document:getPageCount()
|
||||
assert.are.same(28, #footer.progress_bar.ticks)
|
||||
assert.are.same(page_count, footer.progress_bar.last)
|
||||
end)
|
||||
|
||||
it("should schedule/unschedule auto refresh time task", function()
|
||||
|
||||
@@ -83,9 +83,9 @@ describe("Readerhighlight module", function()
|
||||
end)
|
||||
it("should response on tap gesture", function()
|
||||
tap_highlight_text(readerui,
|
||||
Geom:new{ x = 62, y = 374 },
|
||||
Geom:new{ x = 484, y = 374 },
|
||||
Geom:new{ x = 331, y = 374 })
|
||||
Geom:new{ x = 26, y = 374 },
|
||||
Geom:new{ x = 484, y = 574 },
|
||||
Geom:new{ x = 331, y = 474 })
|
||||
Screen:shot("screenshots/reader_tap_highlight_text_epub.png")
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -56,7 +56,7 @@ describe("Readersearch module", function()
|
||||
local words = search:searchFromStart("Verona")
|
||||
assert.truthy(words)
|
||||
local pageno = doc:getPageFromXPointer(words[1].start)
|
||||
assert.are.equal(9, pageno)
|
||||
assert.truthy(pageno < 10)
|
||||
end
|
||||
for i = 1, 5, 1 do
|
||||
rolling:onGotoPage(i)
|
||||
@@ -70,7 +70,7 @@ describe("Readersearch module", function()
|
||||
local words = search:searchFromEnd("Verona")
|
||||
assert.truthy(words)
|
||||
local pageno = doc:getPageFromXPointer(words[1].start)
|
||||
assert.are.equal(203, pageno)
|
||||
assert.truthy(pageno > 200)
|
||||
end
|
||||
for i = 230, 235, 1 do
|
||||
rolling:onGotoPage(i)
|
||||
|
||||
@@ -55,24 +55,24 @@ describe("Readertoc module", function()
|
||||
end)
|
||||
end)
|
||||
it("should get page of next chapter", function()
|
||||
assert.are.same(26, toc:getNextChapter(10, 0))
|
||||
assert.are.same(102, toc:getNextChapter(100, 0))
|
||||
assert.truthy(toc:getNextChapter(10, 0) > 10)
|
||||
assert.truthy(toc:getNextChapter(100, 0) > 100)
|
||||
assert.are.same(nil, toc:getNextChapter(200, 0))
|
||||
end)
|
||||
it("should get page of previous chapter", function()
|
||||
assert.are.same(9, toc:getPreviousChapter(10, 0))
|
||||
assert.are.same(99, toc:getPreviousChapter(100, 0))
|
||||
assert.are.same(186, toc:getPreviousChapter(200, 0))
|
||||
assert.truthy(toc:getPreviousChapter(10, 0) < 10)
|
||||
assert.truthy(toc:getPreviousChapter(100, 0) < 100)
|
||||
assert.truthy(toc:getPreviousChapter(200, 0) < 200)
|
||||
end)
|
||||
it("should get page left of chapter", function()
|
||||
assert.are.same(15, toc:getChapterPagesLeft(10, 0))
|
||||
assert.are.same(12, toc:getChapterPagesLeft(102, 0))
|
||||
assert.truthy(toc:getChapterPagesLeft(10, 0) > 10)
|
||||
assert.truthy(toc:getChapterPagesLeft(102, 0) > 10)
|
||||
assert.are.same(nil, toc:getChapterPagesLeft(200, 0))
|
||||
end)
|
||||
it("should get page done of chapter", function()
|
||||
assert.are.same(2, toc:getChapterPagesDone(12, 0))
|
||||
assert.are.same(0, toc:getChapterPagesDone(99, 0))
|
||||
assert.are.same(18, toc:getChapterPagesDone(204, 0))
|
||||
assert.truthy(toc:getChapterPagesDone(12, 0) < 5)
|
||||
assert.truthy(toc:getChapterPagesDone(99, 0) < 5)
|
||||
assert.truthy(toc:getChapterPagesDone(204, 0) > 10)
|
||||
end)
|
||||
describe("collasible TOC", function()
|
||||
it("should collapse the secondary toc nodes by default", function()
|
||||
|
||||
Reference in New Issue
Block a user