diff --git a/base b/base index 399063859..52466a536 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 399063859a9ca74941970e114d87fc275a854fa4 +Subproject commit 52466a536689ef97ef62d7db9d5491439c3a537b diff --git a/frontend/document/credocument.lua b/frontend/document/credocument.lua index 515638959..eb4507584 100644 --- a/frontend/document/credocument.lua +++ b/frontend/document/credocument.lua @@ -323,7 +323,7 @@ function CreDocument:drawCurrentView(target, x, y, rect, pos) -- change has been made, to avoid having crengine redraw the exact -- same buffer. -- And it could only change when some other methods from here are called - self._document:drawCurrentPage(self.buffer, self.render_color) + self._drawn_images_count, self._drawn_images_surface_ratio = self._document:drawCurrentPage(self.buffer, self.render_color) target:blitFrom(self.buffer, x, y, 0, 0, rect.w, rect.h) end diff --git a/frontend/document/document.lua b/frontend/document/document.lua index fb3b66053..d25f9651c 100644 --- a/frontend/document/document.lua +++ b/frontend/document/document.lua @@ -402,6 +402,11 @@ function Document:drawPage(target, x, y, rect, pageno, zoom, rotation, gamma, re rect.w, rect.h) end +function Document:getDrawnImagesStatistics() + -- For now, only set by CreDocument in CreDocument:drawCurrentView() + return self._drawn_images_count, self._drawn_images_surface_ratio +end + function Document:getPageText(pageno) -- is this worth caching? not done yet. local page = self._document:openPage(pageno) diff --git a/spec/unit/readerrolling_spec.lua b/spec/unit/readerrolling_spec.lua index 27325fbae..5909b8a4a 100644 --- a/spec/unit/readerrolling_spec.lua +++ b/spec/unit/readerrolling_spec.lua @@ -186,13 +186,13 @@ describe("Readerrolling module", function() it("should show pages for different word gap", function() readerui.document:setSpaceCondensing(100) readerui:handleEvent(Event:new("ChangeScreenMode", "portrait")) - assert.are.same(266, readerui.document:getPageCount()) + assert.are.same(249, readerui.document:getPageCount()) readerui.document:setSpaceCondensing(75) readerui:handleEvent(Event:new("ChangeScreenMode", "portrait")) - assert.are.same(261, readerui.document:getPageCount()) + assert.are.same(242, readerui.document:getPageCount()) readerui.document:setSpaceCondensing(50) readerui:handleEvent(Event:new("ChangeScreenMode", "portrait")) - assert.are.same(247, readerui.document:getPageCount()) + assert.are.same(233, readerui.document:getPageCount()) end) end) diff --git a/spec/unit/readersearch_spec.lua b/spec/unit/readersearch_spec.lua index 5d6b8b892..ef84edca5 100644 --- a/spec/unit/readersearch_spec.lua +++ b/spec/unit/readersearch_spec.lua @@ -66,8 +66,8 @@ describe("Readersearch module", function() end) it("should find the last occurrence", function() -- local logger = require("logger") - -- logger.info("nb of pages", doc:getPageCount()) - -- 20181208: currently 266 pages + -- logger.warn("nb of pages", doc:getPageCount()) + -- 20190202: currently 242 pages for i = 100, 180, 10 do rolling:onGotoPage(i) local words = search:searchFromEnd("Verona") diff --git a/spec/unit/readertoc_spec.lua b/spec/unit/readertoc_spec.lua index b12615640..6c160924e 100644 --- a/spec/unit/readertoc_spec.lua +++ b/spec/unit/readertoc_spec.lua @@ -25,7 +25,7 @@ describe("Readertoc module", function() title = toc:getTocTitleByPage(60) DEBUG("toc", toc.toc) assert(title == "SCENE V. A hall in Capulet's house.") - title = toc:getTocTitleByPage(195) + title = toc:getTocTitleByPage(187) assert(title == "SCENE I. Friar Laurence's cell.") end) describe("getTocTicks API", function() @@ -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(97, 0) > 10) assert.are.same(nil, toc:getChapterPagesLeft(290, 0)) end) it("should get page done of chapter", function()