diff --git a/.gitignore b/.gitignore index e4a04a2d8..e21ed8219 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ git-rev tags test/* *.tar +*.log spec/unit/data emu diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index bb718e00d..388c697f3 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -27,7 +27,7 @@ local ReaderFooter = InputContainer:new{ text_width = 0.15, text_font_face = "ffont", text_font_size = 14, - height = 19, + height = Screen:scaleByDPI(19), } function ReaderFooter:init() @@ -54,11 +54,14 @@ function ReaderFooter:init() table.insert(horizontal_group, text_container) self[1] = BottomContainer:new{ dimen = Screen:getSize(), - FrameContainer:new{ - horizontal_group, - background = 0, - bordersize = 0, - padding = 0, + BottomContainer:new{ + dimen = Geom:new{w = Screen:getWidth(), h = self.height*2}, + FrameContainer:new{ + horizontal_group, + background = 0, + bordersize = 0, + padding = 0, + } } } self.dimen = self[1]:getSize() diff --git a/koreader-base b/koreader-base index 6a0bced81..06ce7a616 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 6a0bced813af76301301dc65dbd8bacb46a617b4 +Subproject commit 06ce7a616da2fc66bf476927d7ef9eb08ec4aab8 diff --git a/spec/unit/benchmark_spec.lua b/spec/unit/benchmark_spec.lua new file mode 100644 index 000000000..f4ad90971 --- /dev/null +++ b/spec/unit/benchmark_spec.lua @@ -0,0 +1,45 @@ +require "defaults" +require "libs/libkoreader-luagettext" +package.path = "?.lua;common/?.lua;frontend/?.lua" +package.cpath = "?.so;common/?.so;/usr/lib/lua/?.so" + +-- global einkfb for Screen +einkfb = require("ffi/framebuffer") +-- do not show SDL window +einkfb.dummy = true +Blitbuffer = require("ffi/blitbuffer") +util = require("ffi/util") + +local Screen = require("ui/screen") +local DocSettings = require("docsettings") +G_reader_settings = DocSettings:open(".reader") +local DocumentRegistry = require("document/documentregistry") +local DEBUG = require("dbg") + +-- screen should be inited for crengine +Screen:init() + +function logDuration(filename, pageno, dur) + local file = io.open(filename, "a+") + if file then + if file:seek("end") == 0 then -- write the header only once + file:write("PAGE\tDUR\n") + end + file:write(string.format("%s\t%s\n", pageno, dur)) + file:close() + end +end + +describe("PDF rendering benchmark", function() + local sample_pdf = "spec/front/unit/data/sample.pdf" + local doc = DocumentRegistry:openDocument(sample_pdf) + for pageno = 1, doc.info.number_of_pages do + local secs, usecs = util.gettime() + assert.truthy(doc:renderPage(pageno, nil, 1, 0, 1.0, 0)) + local nsecs, nusecs = util.gettime() + local dur = nsecs - secs + (nusecs - usecs) / 1000000 + logDuration("pdf_rendering.log", pageno, dur) + end + doc:close() +end) + diff --git a/spec/unit/document_spec.lua b/spec/unit/document_spec.lua index 73ed68895..0ea747acd 100644 --- a/spec/unit/document_spec.lua +++ b/spec/unit/document_spec.lua @@ -50,11 +50,10 @@ describe("PDF document module", function() end) describe("EPUB document module", function() - local sample_epub = "spec/front/unit/data/leaves_of_grass.epub" + local sample_epub = "spec/front/unit/data/leaves.epub" it("should open document", function() doc = DocumentRegistry:openDocument(sample_epub) assert.truthy(doc) - doc:close() end) it("should close document", function() doc:close() diff --git a/test/leaves.epub b/test/leaves.epub new file mode 100644 index 000000000..afcf41e33 Binary files /dev/null and b/test/leaves.epub differ