You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koreader/spec/unit/cache_spec.lua

42 lines
1.4 KiB
Lua

require("commonrequire")
10 years ago
local DocumentRegistry = require("document/documentregistry")
local Cache = require("cache")
local DEBUG = require("dbg")
describe("Cache module", function()
local sample_pdf = "spec/front/unit/data/sample.pdf"
local doc = DocumentRegistry:openDocument(sample_pdf)
it("should clear cache", function()
Cache:clear()
end)
local max_page = 1
10 years ago
it("should serialize blitbuffer", function()
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
10 years ago
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
Cache:serialize()
end
Cache:clear()
end)
it("should deserialize blitbuffer", function()
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
10 years ago
doc:hintPage(pageno, 1, 0, 1.0, 0)
end
Cache:clear()
end)
it("should serialize koptcontext", function()
doc.configurable.text_wrap = 1
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
10 years ago
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
doc:getPageDimensions(pageno)
Cache:serialize()
end
Cache:clear()
end)
it("should deserialize koptcontext", function()
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
10 years ago
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
end
Cache:clear()
end)
end)