2014-10-07 05:06:06 +00:00
|
|
|
require("commonrequire")
|
2014-05-30 15:20:55 +00:00
|
|
|
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)
|
2014-10-06 13:31:04 +00:00
|
|
|
local max_page = 1
|
2014-05-30 15:20:55 +00:00
|
|
|
it("should serialize blitbuffer", function()
|
2014-10-06 13:31:04 +00:00
|
|
|
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
|
2014-05-30 15:20:55 +00:00
|
|
|
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
|
|
|
|
Cache:serialize()
|
|
|
|
end
|
|
|
|
Cache:clear()
|
|
|
|
end)
|
|
|
|
it("should deserialize blitbuffer", function()
|
2014-10-06 13:31:04 +00:00
|
|
|
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
|
2014-05-30 15:20:55 +00:00
|
|
|
doc:hintPage(pageno, 1, 0, 1.0, 0)
|
|
|
|
end
|
|
|
|
Cache:clear()
|
|
|
|
end)
|
|
|
|
it("should serialize koptcontext", function()
|
|
|
|
doc.configurable.text_wrap = 1
|
2014-10-06 13:31:04 +00:00
|
|
|
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
|
2014-05-30 15:20:55 +00:00
|
|
|
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
|
|
|
|
doc:getPageDimensions(pageno)
|
|
|
|
Cache:serialize()
|
|
|
|
end
|
|
|
|
Cache:clear()
|
|
|
|
end)
|
|
|
|
it("should deserialize koptcontext", function()
|
2014-10-06 13:31:04 +00:00
|
|
|
for pageno = 1, math.min(max_page, doc.info.number_of_pages) do
|
2014-05-30 15:20:55 +00:00
|
|
|
doc:renderPage(pageno, nil, 1, 0, 1.0, 0)
|
|
|
|
end
|
|
|
|
Cache:clear()
|
|
|
|
end)
|
|
|
|
end)
|