mirror of https://github.com/koreader/koreader
Merge pull request #962 from chrox/coverage
coverage test only sources from frontend and pluginspull/963/head
commit
373750603a
@ -0,0 +1,23 @@
|
||||
require "defaults"
|
||||
package.path = "?.lua;common/?.lua;frontend/?.lua;" .. package.path
|
||||
package.cpath = "?.so;common/?.so;/usr/lib/lua/?.so;" .. package.cpath
|
||||
|
||||
-- global reader settings
|
||||
local DocSettings = require("docsettings")
|
||||
G_reader_settings = DocSettings:open(".reader")
|
||||
|
||||
-- global einkfb for Screen (do not show SDL window)
|
||||
einkfb = require("ffi/framebuffer")
|
||||
einkfb.dummy = true
|
||||
|
||||
-- init output device
|
||||
local Screen = require("ui/screen")
|
||||
Screen:init()
|
||||
|
||||
-- init input device (do not show SDL window)
|
||||
local Input = require("ui/input")
|
||||
Input.dummy = true
|
||||
|
||||
-- turn on debug
|
||||
local DEBUG = require("dbg")
|
||||
DEBUG:turnOn()
|
@ -0,0 +1,28 @@
|
||||
require("commonrequire")
|
||||
local DocumentRegistry = require("document/documentregistry")
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
local DocSettings = require("docsettings")
|
||||
local DEBUG = require("dbg")
|
||||
|
||||
describe("Readerui module", function()
|
||||
local sample_epub = "spec/front/unit/data/leaves.epub"
|
||||
local readerui = ReaderUI:new{
|
||||
document = DocumentRegistry:openDocument(sample_epub),
|
||||
}
|
||||
it("should save settings", function()
|
||||
-- remove history settings and sidecar settings
|
||||
DocSettings:open(sample_epub):clear()
|
||||
local doc_settings = DocSettings:open(sample_epub)
|
||||
assert.are.same(doc_settings.data, {})
|
||||
readerui:saveSettings()
|
||||
assert.are_not.same(readerui.doc_settings.data, {})
|
||||
doc_settings = DocSettings:open(sample_epub)
|
||||
assert.truthy(doc_settings.data.last_xpointer)
|
||||
assert.are.same(doc_settings.data.last_xpointer,
|
||||
readerui.doc_settings.data.last_xpointer)
|
||||
end)
|
||||
it("should close document", function()
|
||||
readerui:closeDocument()
|
||||
assert(readerui.document == nil)
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue