mirror of
https://github.com/koreader/koreader
synced 2024-11-16 06:12:56 +00:00
9b7aba3fba
Also fix touch zone dependency graph generation code. ReaderHighlight has now been migrated to use touch zone Inputcontainer's touch event handling logic changed to only stop propagation when handler returns `true`. Previously, it stops propagation when a handler is found. This is needed to support both readerhighlight_tap and tap_forward touch zones.
53 lines
1.7 KiB
Lua
53 lines
1.7 KiB
Lua
require "defaults"
|
|
package.path = "?.lua;common/?.lua;rocks/share/lua/5.1/?.lua;frontend/?.lua;" .. package.path
|
|
package.cpath = "?.so;common/?.so;/usr/lib/lua/?.so;rocks/lib/lua/5.1/?.so;" .. package.cpath
|
|
|
|
-- turn off debug by default and set log level to warning
|
|
require("dbg"):turnOff()
|
|
local logger = require("logger")
|
|
logger:setLevel(logger.levels.warn)
|
|
|
|
-- global reader settings
|
|
local DataStorage = require("datastorage")
|
|
os.remove(DataStorage:getDataDir().."/settings.reader.lua")
|
|
local DocSettings = require("docsettings")
|
|
G_reader_settings = require("luasettings"):open(".reader")
|
|
|
|
-- global einkfb for Screen (do not show SDL window)
|
|
einkfb = require("ffi/framebuffer")
|
|
einkfb.dummy = true
|
|
|
|
-- init output device
|
|
local Screen = require("device").screen
|
|
Screen:init()
|
|
|
|
-- init input device (do not show SDL window)
|
|
local Input = require("device").input
|
|
Input.dummy = true
|
|
|
|
function assertAlmostEquals(expected, actual, margin)
|
|
if type(actual) ~= 'number' or type(expected) ~= 'number'
|
|
or type(margin) ~= 'number' then
|
|
error('assertAlmostEquals: must supply only number arguments.', 2)
|
|
end
|
|
|
|
assert(math.abs(expected - actual) <= margin,
|
|
'Values are not almost equal\n'
|
|
.. 'Expected: ' .. expected .. ' with margin of ' .. margin
|
|
.. ', received: ' .. actual
|
|
)
|
|
end
|
|
|
|
function assertNotAlmostEquals(expected, actual, margin)
|
|
if type(actual) ~= 'number' or type(expected) ~= 'number'
|
|
or type(margin) ~= 'number' then
|
|
error('assertAlmostEquals: must supply only number arguments.', 2)
|
|
end
|
|
|
|
assert(math.abs(expected - actual) > margin,
|
|
'Values are almost equal\n'
|
|
.. 'Expected: ' .. expected .. ' with margin of ' .. margin
|
|
.. ', received: ' .. actual
|
|
)
|
|
end
|