fix(readerlink): restore reader view context on go back

pull/1927/head
Qingping Hou 8 years ago
parent 2d5222ef33
commit 11d5b5c0a1

2
.gitignore vendored

@ -8,7 +8,7 @@ lua-*
.vimrc .vimrc
*.o *.o
tags tags
test/* test/*.sdr
*.tar *.tar
*.log *.log
spec/unit/data spec/unit/data

@ -9,7 +9,7 @@ local Event = require("ui/event")
local _ = require("gettext") local _ = require("gettext")
local ReaderLink = InputContainer:new{ local ReaderLink = InputContainer:new{
link_states = {} location_stack = {}
} }
function ReaderLink:init() function ReaderLink:init()
@ -23,7 +23,7 @@ end
function ReaderLink:onReadSettings(config) function ReaderLink:onReadSettings(config)
-- called when loading new document -- called when loading new document
self.link_states = {} self.location_stack = {}
end end
function ReaderLink:initGesListener() function ReaderLink:initGesListener()
@ -77,7 +77,7 @@ function ReaderLink:addToMainMenu(tab_item_table)
}, },
{ {
text = _("Go back"), text = _("Go back"),
enabled_func = function() return #self.link_states > 0 end, enabled_func = function() return #self.location_stack > 0 end,
callback = function() self:onGoBackLink() end, callback = function() self:onGoBackLink() end,
}, },
{ {
@ -99,7 +99,7 @@ function ReaderLink:onSetDimensions(dimen)
end end
end end
function ReaderLink:onTap(arg, ges) function ReaderLink:onTap(_, ges)
if not is_follow_links_on() then return end if not is_follow_links_on() then return end
if self.ui.document.info.has_pages then if self.ui.document.info.has_pages then
local pos = self.view:screenToPageTransform(ges.pos) local pos = self.view:screenToPageTransform(ges.pos)
@ -130,25 +130,24 @@ end
function ReaderLink:onGotoLink(link) function ReaderLink:onGotoLink(link)
if self.ui.document.info.has_pages then if self.ui.document.info.has_pages then
table.insert(self.link_states, self.view.state.page) table.insert(self.location_stack, self.ui.paging:getBookLocation())
self.ui:handleEvent(Event:new("GotoPage", link.page + 1)) self.ui:handleEvent(Event:new("GotoPage", link.page + 1))
else else
table.insert(self.link_states, self.ui.document:getXPointer()) table.insert(self.location_stack, self.ui.rolling:getBookLocation())
self.ui:handleEvent(Event:new("GotoXPointer", link)) self.ui:handleEvent(Event:new("GotoXPointer", link))
end end
return true return true
end end
function ReaderLink:onGoBackLink() function ReaderLink:onGoBackLink()
local last_page_or_xp = table.remove(self.link_states) local saved_location = table.remove(self.location_stack)
if last_page_or_xp then if saved_location then
local event = self.ui.document.info.has_pages and "GotoPage" or "GotoXPointer" self.ui:handleEvent(Event:new('RestoreBookLocation', saved_location))
self.ui:handleEvent(Event:new(event, last_page_or_xp))
return true
end end
return true
end end
function ReaderLink:onSwipe(arg, ges) function ReaderLink:onSwipe(_, ges)
if ges.direction == "east" and swipe_to_go_back() then if ges.direction == "east" and swipe_to_go_back() then
return self:onGoBackLink() return self:onGoBackLink()
end end

@ -1,9 +1,9 @@
local InputContainer = require("ui/widget/container/inputcontainer") local InputContainer = require("ui/widget/container/inputcontainer")
local Screen = require("device").screen
local Geom = require("ui/geometry") local Geom = require("ui/geometry")
local Input = require("device").input local Input = require("device").input
local GestureRange = require("ui/gesturerange") local GestureRange = require("ui/gesturerange")
local Device = require("device") local Device = require("device")
local Screen = Device.screen
local Event = require("ui/event") local Event = require("ui/event")
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local Math = require("optmath") local Math = require("optmath")
@ -121,7 +121,7 @@ end
function ReaderPaging:onReadSettings(config) function ReaderPaging:onReadSettings(config)
self.page_positions = config:readSetting("page_positions") or {} self.page_positions = config:readSetting("page_positions") or {}
self:gotoPage(config:readSetting("last_page") or 1) self:_gotoPage(config:readSetting("last_page") or 1)
self.show_overlap_enable = config:readSetting("show_overlap_enable") self.show_overlap_enable = config:readSetting("show_overlap_enable")
if self.show_overlap_enable == nil then if self.show_overlap_enable == nil then
self.show_overlap_enable = DSHOWOVERLAP self.show_overlap_enable = DSHOWOVERLAP
@ -131,6 +131,7 @@ function ReaderPaging:onReadSettings(config)
end end
function ReaderPaging:onSaveSettings() function ReaderPaging:onSaveSettings()
-- TODO: only save current_page page position
self.ui.doc_settings:saveSetting("page_positions", self.page_positions) self.ui.doc_settings:saveSetting("page_positions", self.page_positions)
self.ui.doc_settings:saveSetting("last_page", self:getTopPage()) self.ui.doc_settings:saveSetting("last_page", self:getTopPage())
self.ui.doc_settings:saveSetting("percent_finished", self:getLastPercent()) self.ui.doc_settings:saveSetting("percent_finished", self:getLastPercent())
@ -181,9 +182,10 @@ end
--[[ --[[
Set reading position on certain page Set reading position on certain page
Page position is a fractional number ranging from 0 to 1, indicating the read percentage on Page position is a fractional number ranging from 0 to 1, indicating the read
certain page. With the position information on each page whenever users change font size, percentage on certain page. With the position information on each page whenever
page margin or line spacing or close and reopen the book, the page view will be roughly the same. users change font size, page margin or line spacing or close and reopen the
book, the page view will be roughly the same.
--]] --]]
function ReaderPaging:setPagePosition(page, pos) function ReaderPaging:setPagePosition(page, pos)
DEBUG("set page position", pos) DEBUG("set page position", pos)
@ -244,7 +246,7 @@ function ReaderPaging:onToggleBookmarkFlipping()
self.view.flipping_visible = self.orig_flipping_mode self.view.flipping_visible = self.orig_flipping_mode
self.view.dogear_visible = self.orig_dogear_mode self.view.dogear_visible = self.orig_dogear_mode
self:exitFlippingMode() self:exitFlippingMode()
self:gotoPage(self.bm_flipping_orig_page) self:_gotoPage(self.bm_flipping_orig_page)
end end
self.ui:handleEvent(Event:new("SetHinting", not self.bookmark_flipping_mode)) self.ui:handleEvent(Event:new("SetHinting", not self.bookmark_flipping_mode))
self.ui:handleEvent(Event:new("ReZoom")) self.ui:handleEvent(Event:new("ReZoom"))
@ -292,13 +294,13 @@ function ReaderPaging:pageFlipping(flipping_page, flipping_ges)
local stp_proportion = flipping_ges.distance / Screen:getWidth() local stp_proportion = flipping_ges.distance / Screen:getWidth()
local abs_proportion = flipping_ges.distance / Screen:getHeight() local abs_proportion = flipping_ges.distance / Screen:getHeight()
if flipping_ges.direction == "east" then if flipping_ges.direction == "east" then
self:gotoPage(flipping_page - self.flip_steps[math.ceil(steps*stp_proportion)]) self:_gotoPage(flipping_page - self.flip_steps[math.ceil(steps*stp_proportion)])
elseif flipping_ges.direction == "west" then elseif flipping_ges.direction == "west" then
self:gotoPage(flipping_page + self.flip_steps[math.ceil(steps*stp_proportion)]) self:_gotoPage(flipping_page + self.flip_steps[math.ceil(steps*stp_proportion)])
elseif flipping_ges.direction == "south" then elseif flipping_ges.direction == "south" then
self:gotoPage(flipping_page - math.floor(whole*abs_proportion)) self:_gotoPage(flipping_page - math.floor(whole*abs_proportion))
elseif flipping_ges.direction == "north" then elseif flipping_ges.direction == "north" then
self:gotoPage(flipping_page + math.floor(whole*abs_proportion)) self:_gotoPage(flipping_page + math.floor(whole*abs_proportion))
end end
UIManager:setDirty(self.view.dialog, "partial") UIManager:setDirty(self.view.dialog, "partial")
end end
@ -316,7 +318,7 @@ function ReaderPaging:onSwipe(arg, ges)
if self.bookmark_flipping_mode then if self.bookmark_flipping_mode then
self:bookmarkFlipping(self.current_page, ges) self:bookmarkFlipping(self.current_page, ges)
elseif self.page_flipping_mode and self.original_page then elseif self.page_flipping_mode and self.original_page then
self:gotoPage(self.original_page) self:_gotoPage(self.original_page)
elseif ges.direction == "west" then elseif ges.direction == "west" then
self:onPagingRel(1) self:onPagingRel(1)
elseif ges.direction == "east" then elseif ges.direction == "east" then
@ -362,10 +364,10 @@ function ReaderPaging:onZoomModeUpdate(new_mode)
self.zoom_mode = new_mode self.zoom_mode = new_mode
end end
function ReaderPaging:onPageUpdate(new_page_no, orig) function ReaderPaging:onPageUpdate(new_page_no, orig_mode)
self.current_page = new_page_no self.current_page = new_page_no
if orig ~= "scrolling" then if self.view.page_scroll and orig_mode ~= "scrolling" then
self.ui:handleEvent(Event:new("InitScrollPageStates", orig)) self.ui:handleEvent(Event:new("InitScrollPageStates", orig_mode))
end end
end end
@ -382,7 +384,7 @@ function ReaderPaging:onGotoPercent(percent)
if dest > self.number_of_pages then if dest > self.number_of_pages then
dest = self.number_of_pages dest = self.number_of_pages
end end
self:gotoPage(dest) self:_gotoPage(dest)
return true return true
end end
@ -404,6 +406,26 @@ function ReaderPaging:onPanningRel(diff)
return true return true
end end
function ReaderPaging:getBookLocation()
return self.view:getViewContext()
end
function ReaderPaging:onRestoreBookLocation(saved_location)
if self.view.page_scroll then
self.view:restoreViewContext(saved_location)
self:_gotoPage(self.view.page_states[#self.view.page_states].page,
"scrolling")
else
-- gotoPage will emit PageUpdate event, which will trigger recalculate
-- in ReaderView and resets the view context. So we need to call
-- restoreViewContext after gotoPage
self:_gotoPage(saved_location[1].page)
self.view:restoreViewContext(saved_location)
end
self:setPagePosition(self:getTopPage(), self:getTopPosition())
return true
end
--[[ --[[
Get read percentage on current page. Get read percentage on current page.
--]] --]]
@ -428,8 +450,8 @@ function ReaderPaging:getTopPage()
end end
end end
function ReaderPaging:onInitScrollPageStates(orig) function ReaderPaging:onInitScrollPageStates(orig_mode)
DEBUG("init scroll page states", orig) DEBUG("init scroll page states", orig_mode)
if self.view.page_scroll and self.view.state.page then if self.view.page_scroll and self.view.state.page then
self.orig_page = self.current_page self.orig_page = self.current_page
self.view.page_states = {} self.view.page_states = {}
@ -451,10 +473,10 @@ function ReaderPaging:onInitScrollPageStates(orig)
blank_area.h = blank_area.h - self.view.page_gap.height blank_area.h = blank_area.h - self.view.page_gap.height
end end
if blank_area.h > 0 then if blank_area.h > 0 then
self:gotoPage(self.current_page + 1, "scrolling") self:_gotoPage(self.current_page + 1, "scrolling")
end end
end end
self:gotoPage(self.orig_page, "scrolling") self:_gotoPage(self.orig_page, "scrolling")
end end
return true return true
end end
@ -566,7 +588,7 @@ function ReaderPaging:genPageStatesFromTop(top_page_state, blank_area, offset)
blank_area.h = blank_area.h - self.view.page_gap.height blank_area.h = blank_area.h - self.view.page_gap.height
if blank_area.h > 0 then if blank_area.h > 0 then
if self.current_page == self.number_of_pages then break end if self.current_page == self.number_of_pages then break end
self:gotoPage(current_page + 1, "scrolling") self:_gotoPage(current_page + 1, "scrolling")
current_page = current_page + 1 current_page = current_page + 1
local state = self:getNextPageState(blank_area, Geom:new{}) local state = self:getNextPageState(blank_area, Geom:new{})
table.insert(page_states, state) table.insert(page_states, state)
@ -588,7 +610,7 @@ function ReaderPaging:genPageStatesFromBottom(bottom_page_state, blank_area, off
blank_area.h = blank_area.h - self.view.page_gap.height blank_area.h = blank_area.h - self.view.page_gap.height
if blank_area.h > 0 then if blank_area.h > 0 then
if self.current_page == 1 then break end if self.current_page == 1 then break end
self:gotoPage(current_page - 1, "scrolling") self:_gotoPage(current_page - 1, "scrolling")
current_page = current_page - 1 current_page = current_page - 1
local state = self:getPrevPageState(blank_area, Geom:new{}) local state = self:getPrevPageState(blank_area, Geom:new{})
table.insert(page_states, 1, state) table.insert(page_states, 1, state)
@ -618,7 +640,7 @@ function ReaderPaging:onScrollPanRel(diff)
self.view.page_states = self:genPageStatesFromBottom(last_page_state, blank_area, offset) self.view.page_states = self:genPageStatesFromBottom(last_page_state, blank_area, offset)
end end
-- update current pageno to the very last part in current view -- update current pageno to the very last part in current view
self:gotoPage(self.view.page_states[#self.view.page_states].page, "scrolling") self:_gotoPage(self.view.page_states[#self.view.page_states].page, "scrolling")
UIManager:setDirty(self.view.dialog, "fast") UIManager:setDirty(self.view.dialog, "fast")
end end
@ -637,16 +659,16 @@ function ReaderPaging:onScrollPageRel(diff)
table.insert(self.view.page_states, last_page_state) table.insert(self.view.page_states, last_page_state)
self.ui:handleEvent(Event:new("EndOfBook")) self.ui:handleEvent(Event:new("EndOfBook"))
return true return true
else
local blank_area = Geom:new{}
blank_area:setSizeTo(self.view.dimen)
local overlap = self:calculateOverlap()
local offset = Geom:new{
x = 0,
y = last_visible_area.h - overlap
}
self.view.page_states = self:genPageStatesFromTop(last_page_state, blank_area, offset)
end end
local blank_area = Geom:new{}
blank_area:setSizeTo(self.view.dimen)
local overlap = self:calculateOverlap()
local offset = Geom:new{
x = 0,
y = last_visible_area.h - overlap
}
self.view.page_states = self:genPageStatesFromTop(last_page_state, blank_area, offset)
elseif diff < 0 then elseif diff < 0 then
local blank_area = Geom:new{} local blank_area = Geom:new{}
blank_area:setSizeTo(self.view.dimen) blank_area:setSizeTo(self.view.dimen)
@ -661,7 +683,7 @@ function ReaderPaging:onScrollPageRel(diff)
return true return true
end end
-- update current pageno to the very last part in current view -- update current pageno to the very last part in current view
self:gotoPage(self.view.page_states[#self.view.page_states].page, "scrolling") self:_gotoPage(self.view.page_states[#self.view.page_states].page, "scrolling")
UIManager:setDirty(self.view.dialog, "partial") UIManager:setDirty(self.view.dialog, "partial")
return true return true
end end
@ -701,7 +723,7 @@ function ReaderPaging:onGotoPageRel(diff)
if diff > 0 and new_page == self.number_of_pages + 1 then if diff > 0 and new_page == self.number_of_pages + 1 then
self.ui:handleEvent(Event:new("EndOfBook")) self.ui:handleEvent(Event:new("EndOfBook"))
else else
self:gotoPage(new_page) self:_gotoPage(new_page)
end end
-- if we are going back to previous page, reset -- if we are going back to previous page, reset
-- view area to bottom of previous page -- view area to bottom of previous page
@ -777,7 +799,7 @@ function ReaderPaging:onSetDimensions()
end end
-- wrapper for bounds checking -- wrapper for bounds checking
function ReaderPaging:gotoPage(number, orig) function ReaderPaging:_gotoPage(number, orig_mode)
if number == self.current_page or not number then if number == self.current_page or not number then
return true return true
end end
@ -786,24 +808,24 @@ function ReaderPaging:gotoPage(number, orig)
return false return false
end end
-- this is an event to allow other controllers to be aware of this change -- this is an event to allow other controllers to be aware of this change
self.ui:handleEvent(Event:new("PageUpdate", number, orig)) self.ui:handleEvent(Event:new("PageUpdate", number, orig_mode))
return true return true
end end
function ReaderPaging:onGotoPage(number) function ReaderPaging:onGotoPage(number)
self:gotoPage(number) self:_gotoPage(number)
return true return true
end end
function ReaderPaging:onGotoRelativePage(number) function ReaderPaging:onGotoRelativePage(number)
self:gotoPage(self.current_page + number) self:_gotoPage(self.current_page + number)
return true return true
end end
function ReaderPaging:onGotoPercentage(percentage) function ReaderPaging:onGotoPercentage(percentage)
if percentage < 0 then percentage = 0 end if percentage < 0 then percentage = 0 end
if percentage > 1 then percentage = 1 end if percentage > 1 then percentage = 1 end
self:gotoPage(math.floor(percentage*self.number_of_pages)) self:_gotoPage(math.floor(percentage*self.number_of_pages))
return true return true
end end

@ -174,7 +174,7 @@ function ReaderRolling:onReadSettings(config)
if last_xp then if last_xp then
table.insert(self.ui.postInitCallback, function() table.insert(self.ui.postInitCallback, function()
self.xpointer = last_xp self.xpointer = last_xp
self:gotoXPointer(self.xpointer) self:_gotoXPointer(self.xpointer)
-- we have to do a real jump in self.ui.document._document to -- we have to do a real jump in self.ui.document._document to
-- update status information in CREngine. -- update status information in CREngine.
self.ui.document:gotoXPointer(self.xpointer) self.ui.document:gotoXPointer(self.xpointer)
@ -182,7 +182,7 @@ function ReaderRolling:onReadSettings(config)
-- we read last_percent just for backward compatibility -- we read last_percent just for backward compatibility
elseif last_per then elseif last_per then
table.insert(self.ui.postInitCallback, function() table.insert(self.ui.postInitCallback, function()
self:gotoPercent(last_per) self:_gotoPercent(last_per)
-- we have to do a real pos change in self.ui.document._document -- we have to do a real pos change in self.ui.document._document
-- to update status information in CREngine. -- to update status information in CREngine.
self.ui.document:gotoPos(self.current_pos) self.ui.document:gotoPos(self.current_pos)
@ -270,9 +270,9 @@ end
function ReaderRolling:onPan(arg, ges) function ReaderRolling:onPan(arg, ges)
if self.view.view_mode == "scroll" then if self.view.view_mode == "scroll" then
if ges.direction == "north" then if ges.direction == "north" then
self:gotoPos(self.current_pos + ges.distance) self:_gotoPos(self.current_pos + ges.distance)
elseif ges.direction == "south" then elseif ges.direction == "south" then
self:gotoPos(self.current_pos - ges.distance) self:_gotoPos(self.current_pos - ges.distance)
end end
end end
return true return true
@ -311,13 +311,14 @@ end
function ReaderRolling:onGotoPercent(percent) function ReaderRolling:onGotoPercent(percent)
DEBUG("goto document offset in percent:", percent) DEBUG("goto document offset in percent:", percent)
self:gotoPercent(percent) self:_gotoPercent(percent)
self.xpointer = self.ui.document:getXPointer()
return true return true
end end
function ReaderRolling:onGotoPage(number) function ReaderRolling:onGotoPage(number)
if number then if number then
self:gotoPage(number) self:_gotoPage(number)
end end
self.xpointer = self.ui.document:getXPointer() self.xpointer = self.ui.document:getXPointer()
return true return true
@ -325,18 +326,26 @@ end
function ReaderRolling:onGotoRelativePage(number) function ReaderRolling:onGotoRelativePage(number)
if number then if number then
self:gotoPage(self.current_page + number) self:_gotoPage(self.current_page + number)
end end
self.xpointer = self.ui.document:getXPointer() self.xpointer = self.ui.document:getXPointer()
return true return true
end end
function ReaderRolling:onGotoXPointer(xp) function ReaderRolling:onGotoXPointer(xp)
self:gotoXPointer(xp) self:_gotoXPointer(xp)
self.xpointer = xp self.xpointer = xp
return true return true
end end
function ReaderRolling:getBookLocation()
return self.xpointer
end
function ReaderRolling:onRestoreBookLocation(saved_location)
return self:onGotoXPointer(saved_location)
end
function ReaderRolling:onGotoViewRel(diff) function ReaderRolling:onGotoViewRel(diff)
DEBUG("goto relative screen:", diff, ", in mode: ", self.view.view_mode) DEBUG("goto relative screen:", diff, ", in mode: ", self.view.view_mode)
local prev_xp local prev_xp
@ -353,10 +362,10 @@ function ReaderRolling:onGotoViewRel(diff)
pan_diff = pan_diff + self.overlap pan_diff = pan_diff + self.overlap
end end
end end
self:gotoPos(self.current_pos + pan_diff) self:_gotoPos(self.current_pos + pan_diff)
elseif self.view.view_mode == "page" then elseif self.view.view_mode == "page" then
local page_count = self.ui.document:getVisiblePageCount() local page_count = self.ui.document:getVisiblePageCount()
self:gotoPage(self.current_page + diff*page_count) self:_gotoPage(self.current_page + diff*page_count)
end end
self.xpointer = self.ui.document:getXPointer() self.xpointer = self.ui.document:getXPointer()
if self.xpointer == prev_xp then if self.xpointer == prev_xp then
@ -369,7 +378,7 @@ function ReaderRolling:onPanning(args, key)
--@TODO disable panning in page view_mode? 22.12 2012 (houqp) --@TODO disable panning in page view_mode? 22.12 2012 (houqp)
local _, dy = unpack(args) local _, dy = unpack(args)
DEBUG("key =", key) DEBUG("key =", key)
self:gotoPos(self.current_pos + dy * self.panning_steps.normal) self:_gotoPos(self.current_pos + dy * self.panning_steps.normal)
self.xpointer = self.ui.document:getXPointer() self.xpointer = self.ui.document:getXPointer()
return true return true
end end
@ -396,7 +405,7 @@ function ReaderRolling:updatePos()
local new_height = self.ui.document.info.doc_height local new_height = self.ui.document.info.doc_height
local new_page = self.ui.document.info.number_of_pages local new_page = self.ui.document.info.number_of_pages
if self.old_doc_height ~= new_height or self.old_page ~= new_page then if self.old_doc_height ~= new_height or self.old_page ~= new_page then
self:gotoXPointer(self.xpointer) self:_gotoXPointer(self.xpointer)
self.old_doc_height = new_height self.old_doc_height = new_height
self.old_page = new_page self.old_page = new_page
self.ui:handleEvent(Event:new("UpdateToc")) self.ui:handleEvent(Event:new("UpdateToc"))
@ -413,10 +422,10 @@ function ReaderRolling:onChangeViewMode()
self.old_page = self.ui.document.info.number_of_pages self.old_page = self.ui.document.info.number_of_pages
self.ui:handleEvent(Event:new("UpdateToc")) self.ui:handleEvent(Event:new("UpdateToc"))
if self.xpointer then if self.xpointer then
self:gotoXPointer(self.xpointer) self:_gotoXPointer(self.xpointer)
else else
table.insert(self.ui.postInitCallback, function() table.insert(self.ui.postInitCallback, function()
self:gotoXPointer(self.xpointer) self:_gotoXPointer(self.xpointer)
end) end)
end end
return true return true
@ -449,7 +458,7 @@ end
--[[ --[[
PosUpdate event is used to signal other widgets that pos has been changed. PosUpdate event is used to signal other widgets that pos has been changed.
--]] --]]
function ReaderRolling:gotoPos(new_pos) function ReaderRolling:_gotoPos(new_pos)
if new_pos == self.current_pos then return end if new_pos == self.current_pos then return end
if new_pos < 0 then new_pos = 0 end if new_pos < 0 then new_pos = 0 end
if new_pos > self.doc_height then new_pos = self.doc_height end if new_pos > self.doc_height then new_pos = self.doc_height end
@ -468,20 +477,20 @@ function ReaderRolling:gotoPos(new_pos)
self.ui:handleEvent(Event:new("PosUpdate", new_pos)) self.ui:handleEvent(Event:new("PosUpdate", new_pos))
end end
function ReaderRolling:gotoPercent(new_percent) function ReaderRolling:_gotoPercent(new_percent)
self:gotoPos(new_percent * self.doc_height / 10000) self:_gotoPos(new_percent * self.doc_height / 10000)
end end
function ReaderRolling:gotoPage(new_page) function ReaderRolling:_gotoPage(new_page)
self.ui.document:gotoPage(new_page) self.ui.document:gotoPage(new_page)
self.ui:handleEvent(Event:new("PageUpdate", self.ui.document:getCurrentPage())) self.ui:handleEvent(Event:new("PageUpdate", self.ui.document:getCurrentPage()))
end end
function ReaderRolling:gotoXPointer(xpointer) function ReaderRolling:_gotoXPointer(xpointer)
if self.view.view_mode == "page" then if self.view.view_mode == "page" then
self:gotoPage(self.ui.document:getPageFromXPointer(xpointer)) self:_gotoPage(self.ui.document:getPageFromXPointer(xpointer))
else else
self:gotoPos(self.ui.document:getPosFromXPointer(xpointer)) self:_gotoPos(self.ui.document:getPosFromXPointer(xpointer))
end end
end end

@ -623,7 +623,7 @@ function ReaderView:onSetFullScreen(full_screen)
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize())) self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
end end
function ReaderView:onToggleScrollMode(page_scroll) function ReaderView:onSetScrollMode(page_scroll)
self.page_scroll = page_scroll self.page_scroll = page_scroll
self:recalculate() self:recalculate()
self.ui:handleEvent(Event:new("InitScrollPageStates")) self.ui:handleEvent(Event:new("InitScrollPageStates"))

@ -56,7 +56,7 @@ local KoptOptions = {
toggle = {S.ON, S.OFF}, toggle = {S.ON, S.OFF},
values = {1, 0}, values = {1, 0},
default_value = DSCROLL_MODE, default_value = DSCROLL_MODE,
event = "ToggleScrollMode", event = "SetScrollMode",
args = {true, false}, args = {true, false},
}, },
{ {

@ -1,15 +1,20 @@
require("commonrequire") describe("ReaderBookmark module #ok", function()
local DocumentRegistry = require("document/documentregistry") local DocumentRegistry, ReaderUI, UIManager, Screen, Geom, DEBUG
local ReaderUI = require("apps/reader/readerui") local sample_epub, sample_pdf
local UIManager = require("ui/uimanager")
local Screen = require("device").screen
local Geom = require("ui/geometry")
local DEBUG = require("dbg")
local sample_epub = "spec/front/unit/data/juliet.epub" setup(function()
local sample_pdf = "spec/front/unit/data/sample.pdf" require("commonrequire")
DocumentRegistry = require("document/documentregistry")
ReaderUI = require("apps/reader/readerui")
UIManager = require("ui/uimanager")
Screen = require("device").screen
Geom = require("ui/geometry")
DEBUG = require("dbg")
sample_epub = "spec/front/unit/data/juliet.epub"
sample_pdf = "spec/front/unit/data/sample.pdf"
end)
describe("ReaderBookmark module", function()
local function highlight_text(readerui, pos0, pos1) local function highlight_text(readerui, pos0, pos1)
readerui.highlight:onHold(nil, { pos = pos0 }) readerui.highlight:onHold(nil, { pos = pos0 })
readerui.highlight:onHoldPan(nil, { pos = pos1 }) readerui.highlight:onHoldPan(nil, { pos = pos1 })
@ -49,7 +54,7 @@ describe("ReaderBookmark module", function()
before_each(function() before_each(function()
UIManager:quit() UIManager:quit()
UIManager:show(readerui) UIManager:show(readerui)
readerui.rolling:gotoPage(10) readerui.rolling:onGotoPage(10)
end) end)
it("should does bookmark comparison properly", function() it("should does bookmark comparison properly", function()
assert.truthy(readerui.bookmark:isBookmarkSame( assert.truthy(readerui.bookmark:isBookmarkSame(
@ -75,7 +80,7 @@ describe("ReaderBookmark module", function()
it("should sort bookmarks with descending page numbers", function() it("should sort bookmarks with descending page numbers", function()
local pages = {1, 20, 5, 30, 10, 40, 15, 25, 35, 45} local pages = {1, 20, 5, 30, 10, 40, 15, 25, 35, 45}
for _, page in ipairs(pages) do for _, page in ipairs(pages) do
readerui.rolling:gotoPage(page) readerui.rolling:onGotoPage(page)
toggler_dogear(readerui) toggler_dogear(readerui)
end end
readerui.bookmark:onShowBookmark() readerui.bookmark:onShowBookmark()
@ -86,7 +91,7 @@ describe("ReaderBookmark module", function()
it("should keep descending page numbers after removing bookmarks", function() it("should keep descending page numbers after removing bookmarks", function()
local pages = {1, 30, 10, 40, 20} local pages = {1, 30, 10, 40, 20}
for _, page in ipairs(pages) do for _, page in ipairs(pages) do
readerui.rolling:gotoPage(page) readerui.rolling:onGotoPage(page)
toggler_dogear(readerui) toggler_dogear(readerui)
end end
readerui.bookmark:onShowBookmark() readerui.bookmark:onShowBookmark()
@ -123,7 +128,7 @@ describe("ReaderBookmark module", function()
before_each(function() before_each(function()
UIManager:quit() UIManager:quit()
UIManager:show(readerui) UIManager:show(readerui)
readerui.paging:gotoPage(10) readerui.paging:onGotoPage(10)
end) end)
it("should does bookmark comparison properly", function() it("should does bookmark comparison properly", function()
assert.truthy(readerui.bookmark:isBookmarkSame( assert.truthy(readerui.bookmark:isBookmarkSame(
@ -166,7 +171,7 @@ describe("ReaderBookmark module", function()
it("should sort bookmarks with descending page numbers", function() it("should sort bookmarks with descending page numbers", function()
local pages = {1, 20, 5, 30, 10, 40, 15, 25, 35, 45} local pages = {1, 20, 5, 30, 10, 40, 15, 25, 35, 45}
for _, page in ipairs(pages) do for _, page in ipairs(pages) do
readerui.paging:gotoPage(page) readerui.paging:onGotoPage(page)
toggler_dogear(readerui) toggler_dogear(readerui)
end end
readerui.bookmark:onShowBookmark() readerui.bookmark:onShowBookmark()
@ -177,7 +182,7 @@ describe("ReaderBookmark module", function()
it("should keep descending page numbers after removing bookmarks", function() it("should keep descending page numbers after removing bookmarks", function()
local pages = {1, 30, 10, 40, 20} local pages = {1, 30, 10, 40, 20}
for _, page in ipairs(pages) do for _, page in ipairs(pages) do
readerui.paging:gotoPage(page) readerui.paging:onGotoPage(page)
toggler_dogear(readerui) toggler_dogear(readerui)
end end
readerui.bookmark:onShowBookmark() readerui.bookmark:onShowBookmark()

@ -21,7 +21,7 @@ describe("Readerdictionary module", function()
local name = "screenshots/reader_dictionary.png" local name = "screenshots/reader_dictionary.png"
UIManager:quit() UIManager:quit()
UIManager:show(readerui) UIManager:show(readerui)
rolling:gotoPage(100) rolling:onGotoPage(100)
dictionary:onLookupWord("test") dictionary:onLookupWord("test")
UIManager:scheduleIn(1, function() UIManager:scheduleIn(1, function()
UIManager:close(dictionary.dict_window) UIManager:close(dictionary.dict_window)

@ -58,7 +58,7 @@ describe("Readerhighlight module", function()
before_each(function() before_each(function()
UIManager:quit() UIManager:quit()
UIManager:show(readerui) UIManager:show(readerui)
readerui.rolling:gotoPage(page) readerui.rolling:onGotoPage(page)
end) end)
after_each(function() after_each(function()
readerui.highlight:clear() readerui.highlight:clear()
@ -89,7 +89,7 @@ describe("Readerhighlight module", function()
before_each(function() before_each(function()
UIManager:quit() UIManager:quit()
UIManager:show(readerui) UIManager:show(readerui)
readerui.paging:gotoPage(10) readerui.paging:onGotoPage(10)
end) end)
after_each(function() after_each(function()
readerui.highlight:clear() readerui.highlight:clear()
@ -111,7 +111,7 @@ describe("Readerhighlight module", function()
before_each(function() before_each(function()
UIManager:quit() UIManager:quit()
UIManager:show(readerui) UIManager:show(readerui)
readerui.paging:gotoPage(28) readerui.paging:onGotoPage(28)
end) end)
after_each(function() after_each(function()
readerui.highlight:clear() readerui.highlight:clear()
@ -134,7 +134,7 @@ describe("Readerhighlight module", function()
UIManager:quit() UIManager:quit()
readerui.document.configurable.text_wrap = 1 readerui.document.configurable.text_wrap = 1
UIManager:show(readerui) UIManager:show(readerui)
readerui.paging:gotoPage(31) readerui.paging:onGotoPage(31)
end) end)
after_each(function() after_each(function()
readerui.highlight:clear() readerui.highlight:clear()

@ -0,0 +1,108 @@
describe("ReaderLink module", function()
local DocumentRegistry, ReaderUI, UIManager, sample_epub, sample_pdf
setup(function()
require("commonrequire")
DocumentRegistry = require("document/documentregistry")
ReaderUI = require("apps/reader/readerui")
UIManager = require("ui/uimanager")
sample_epub = "spec/front/unit/data/leaves.epub"
sample_pdf = "spec/front/unit/data/Adaptively.Scaling.The.Metropolis.Algorithm.Using.Expected.Squared.Jumped.Distance.pdf"
end)
it("should jump to links in epub", function()
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_epub),
}
readerui.rolling:onGotoPage(4)
readerui.link:onTap(nil, {pos = {x = 171, y = 27}})
assert.is.same(36, readerui.rolling.current_page)
end)
it("should jump to links in pdf", function()
UIManager:quit()
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_pdf),
}
readerui.paging:onGotoPage(1)
readerui.link:onTap(nil, {pos = {x = 363, y = 585}})
UIManager:run()
assert.is.same(22, readerui.paging.current_page)
end)
it("should be able to go back after link jump in epub", function()
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_epub),
}
readerui.rolling:onGotoPage(4)
readerui.link:onTap(nil, {pos = {x = 171, y = 27}})
assert.is.same(36, readerui.rolling.current_page)
readerui.link:onGoBackLink()
assert.is.same(4, readerui.rolling.current_page)
end)
it("should be able to go back after link jump in pdf", function()
UIManager:quit()
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_pdf),
}
readerui.paging:onGotoPage(1)
readerui.link:onTap(nil, {pos = {x = 363, y = 585}})
UIManager:run()
assert.is.same(22, readerui.paging.current_page)
readerui.link:onGoBackLink()
assert.is.same(1, readerui.paging.current_page)
end)
it("should be able to go back after link jump in pdf in scroll mode", function()
UIManager:quit()
local expected_page_states = {
{
gamma = 1,
offset = {x = 17, y = 0},
page = 3,
page_area = {
x = 0, y = 0,
h = 800, w = 566,
},
rotation = 0,
visible_area = {
x = 0, y = 694,
h = 106, w = 566,
},
zoom = 0.9501187648456056456,
},
{
gamma = 1,
offset = {x = 17, y = 0},
page = 4,
page_area = {
h = 800, w = 566,
x = 0, y = 0,
},
rotation = 0,
visible_area = {
h = 686, w = 566,
x = 0, y = 0,
},
zoom = 0.9501187648456056456,
},
}
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_pdf),
}
readerui.view:onSetScrollMode(true)
assert.is.same(true, readerui.view.page_scroll)
readerui.paging:onTapForward()
readerui.paging:onTapForward()
readerui.paging:onTapForward()
assert.is.same(4, readerui.paging.current_page)
assert.are.same(expected_page_states, readerui.view.page_states)
readerui.link:onTap(nil, {pos = {x = 181, y = 366}})
UIManager:run()
assert.is.same(22, readerui.paging.current_page)
readerui.link:onGoBackLink()
assert.is.same(4, readerui.paging.current_page)
assert.are.same(expected_page_states, readerui.view.page_states)
end)
end)

@ -15,7 +15,7 @@ describe("Readerpaging module", function()
it("should emit EndOfBook event at the end", function() it("should emit EndOfBook event at the end", function()
readerui.zooming:setZoomMode("pageheight") readerui.zooming:setZoomMode("pageheight")
paging:gotoPage(readerui.document:getPageCount()) paging:onGotoPage(readerui.document:getPageCount())
local called = false local called = false
readerui.onEndOfBook = function() readerui.onEndOfBook = function()
called = true called = true
@ -35,9 +35,9 @@ describe("Readerpaging module", function()
end) end)
it("should emit EndOfBook event at the end", function() it("should emit EndOfBook event at the end", function()
paging:gotoPage(readerui.document:getPageCount()) paging:onGotoPage(readerui.document:getPageCount())
readerui.zooming:setZoomMode("pageheight") readerui.zooming:setZoomMode("pageheight")
readerui.view:onToggleScrollMode(true) readerui.view:onSetScrollMode(true)
local called = false local called = false
readerui.onEndOfBook = function() readerui.onEndOfBook = function()
called = true called = true

@ -16,13 +16,13 @@ describe("Readerrolling module", function()
end) end)
it("should goto certain page", function() it("should goto certain page", function()
for i = 1, 10, 5 do for i = 1, 10, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
assert.are.same(i, rolling.current_page) assert.are.same(i, rolling.current_page)
end end
end) end)
it("should goto relative page", function() it("should goto relative page", function()
for i = 20, 40, 5 do for i = 20, 40, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
rolling:onGotoViewRel(1) rolling:onGotoViewRel(1)
assert.are.same(i + 1, rolling.current_page) assert.are.same(i + 1, rolling.current_page)
rolling:onGotoViewRel(-1) rolling:onGotoViewRel(-1)
@ -32,7 +32,7 @@ describe("Readerrolling module", function()
it("should goto next chapter", function() it("should goto next chapter", function()
local toc = readerui.toc local toc = readerui.toc
for i = 30, 50, 5 do for i = 30, 50, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
rolling:onDoubleTapForward() rolling:onDoubleTapForward()
assert.are.same(toc:getNextChapter(i, 0), rolling.current_page) assert.are.same(toc:getNextChapter(i, 0), rolling.current_page)
end end
@ -40,13 +40,13 @@ describe("Readerrolling module", function()
it("should goto previous chapter", function() it("should goto previous chapter", function()
local toc = readerui.toc local toc = readerui.toc
for i = 60, 80, 5 do for i = 60, 80, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
rolling:onDoubleTapBackward() rolling:onDoubleTapBackward()
assert.are.same(toc:getPreviousChapter(i, 0), rolling.current_page) assert.are.same(toc:getPreviousChapter(i, 0), rolling.current_page)
end end
end) end)
it("should emit EndOfBook event at the end", function() it("should emit EndOfBook event at the end", function()
rolling:gotoPage(readerui.document:getPageCount()) rolling:onGotoPage(readerui.document:getPageCount())
local called = false local called = false
readerui.onEndOfBook = function() readerui.onEndOfBook = function()
called = true called = true
@ -63,13 +63,13 @@ describe("Readerrolling module", function()
end) end)
it("should goto certain page", function() it("should goto certain page", function()
for i = 1, 10, 5 do for i = 1, 10, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
assert.are.same(i, rolling.current_page) assert.are.same(i, rolling.current_page)
end end
end) end)
it("should goto relative page", function() it("should goto relative page", function()
for i = 20, 40, 5 do for i = 20, 40, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
rolling:onGotoViewRel(1) rolling:onGotoViewRel(1)
assert.are.same(i + 1, rolling.current_page) assert.are.same(i + 1, rolling.current_page)
rolling:onGotoViewRel(-1) rolling:onGotoViewRel(-1)
@ -79,7 +79,7 @@ describe("Readerrolling module", function()
it("should goto next chapter", function() it("should goto next chapter", function()
local toc = readerui.toc local toc = readerui.toc
for i = 30, 50, 5 do for i = 30, 50, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
rolling:onDoubleTapForward() rolling:onDoubleTapForward()
assert.are.same(toc:getNextChapter(i, 0), rolling.current_page) assert.are.same(toc:getNextChapter(i, 0), rolling.current_page)
end end
@ -87,13 +87,13 @@ describe("Readerrolling module", function()
it("should goto previous chapter", function() it("should goto previous chapter", function()
local toc = readerui.toc local toc = readerui.toc
for i = 60, 80, 5 do for i = 60, 80, 5 do
rolling:gotoPage(i) rolling:onGotoPage(i)
rolling:onDoubleTapBackward() rolling:onDoubleTapBackward()
assert.are.same(toc:getPreviousChapter(i, 0), rolling.current_page) assert.are.same(toc:getPreviousChapter(i, 0), rolling.current_page)
end end
end) end)
it("should emit EndOfBook event at the end", function() it("should emit EndOfBook event at the end", function()
rolling:gotoPage(readerui.document:getPageCount()) rolling:onGotoPage(readerui.document:getPageCount())
local called = false local called = false
readerui.onEndOfBook = function() readerui.onEndOfBook = function()
called = true called = true

@ -18,10 +18,10 @@ describe("Readersearch module", function()
rolling = readerui.rolling rolling = readerui.rolling
end) end)
it("should search backward", function() it("should search backward", function()
rolling:gotoPage(10) rolling:onGotoPage(10)
assert.truthy(search:searchFromCurrent("Verona", 1)) assert.truthy(search:searchFromCurrent("Verona", 1))
for i = 1, 100, 10 do for i = 1, 100, 10 do
rolling:gotoPage(i) rolling:onGotoPage(i)
local words = search:searchFromCurrent("Verona", 1) local words = search:searchFromCurrent("Verona", 1)
if words then if words then
for _, word in ipairs(words) do for _, word in ipairs(words) do
@ -33,10 +33,10 @@ describe("Readersearch module", function()
end end
end) end)
it("should search forward", function() it("should search forward", function()
rolling:gotoPage(10) rolling:onGotoPage(10)
assert.truthy(search:searchFromCurrent("Verona", 0)) assert.truthy(search:searchFromCurrent("Verona", 0))
for i = 1, 100, 10 do for i = 1, 100, 10 do
rolling:gotoPage(i) rolling:onGotoPage(i)
local words = search:searchFromCurrent("Verona", 0) local words = search:searchFromCurrent("Verona", 0)
if words then if words then
for _, word in ipairs(words) do for _, word in ipairs(words) do
@ -49,35 +49,35 @@ describe("Readersearch module", function()
end) end)
it("should find the first occurrence", function() it("should find the first occurrence", function()
for i = 10, 100, 10 do for i = 10, 100, 10 do
rolling:gotoPage(i) rolling:onGotoPage(i)
local words = search:searchFromStart("Verona") local words = search:searchFromStart("Verona")
assert.truthy(words) assert.truthy(words)
local pageno = doc:getPageFromXPointer(words[1].start) local pageno = doc:getPageFromXPointer(words[1].start)
assert.are.equal(7, pageno) assert.are.equal(7, pageno)
end end
for i = 1, 5, 1 do for i = 1, 5, 1 do
rolling:gotoPage(i) rolling:onGotoPage(i)
local words = search:searchFromStart("Verona") local words = search:searchFromStart("Verona")
assert(words == nil) assert(words == nil)
end end
end) end)
it("should find the last occurrence", function() it("should find the last occurrence", function()
for i = 100, 180, 10 do for i = 100, 180, 10 do
rolling:gotoPage(i) rolling:onGotoPage(i)
local words = search:searchFromEnd("Verona") local words = search:searchFromEnd("Verona")
assert.truthy(words) assert.truthy(words)
local pageno = doc:getPageFromXPointer(words[1].start) local pageno = doc:getPageFromXPointer(words[1].start)
assert.are.equal(199, pageno) assert.are.equal(199, pageno)
end end
for i = 230, 235, 1 do for i = 230, 235, 1 do
rolling:gotoPage(i) rolling:onGotoPage(i)
local words = search:searchFromEnd("Verona") local words = search:searchFromEnd("Verona")
assert(words == nil) assert(words == nil)
end end
end) end)
it("should find all occurrences", function() it("should find all occurrences", function()
local count = 0 local count = 0
rolling:gotoPage(1) rolling:onGotoPage(1)
local words = search:searchFromCurrent("Verona", 0) local words = search:searchFromCurrent("Verona", 0)
while words do while words do
count = count + #words count = count + #words
@ -129,10 +129,10 @@ describe("Readersearch module", function()
assert.are.equal(0, #doc.koptinterface:findAllMatches(doc, "e", true, 1)) assert.are.equal(0, #doc.koptinterface:findAllMatches(doc, "e", true, 1))
end) end)
it("should search backward", function() it("should search backward", function()
paging:gotoPage(20) paging:onGotoPage(20)
assert.truthy(search:searchFromCurrent("test", 1)) assert.truthy(search:searchFromCurrent("test", 1))
for i = 1, 40, 10 do for i = 1, 40, 10 do
paging:gotoPage(i) paging:onGotoPage(i)
local words = search:searchFromCurrent("test", 1) local words = search:searchFromCurrent("test", 1)
if words then if words then
DEBUG("search backward: found at page", words.page) DEBUG("search backward: found at page", words.page)
@ -141,10 +141,10 @@ describe("Readersearch module", function()
end end
end) end)
it("should search forward", function() it("should search forward", function()
paging:gotoPage(20) paging:onGotoPage(20)
assert.truthy(search:searchFromCurrent("test", 0)) assert.truthy(search:searchFromCurrent("test", 0))
for i = 1, 40, 10 do for i = 1, 40, 10 do
paging:gotoPage(i) paging:onGotoPage(i)
local words = search:searchFromCurrent("test", 0) local words = search:searchFromCurrent("test", 0)
if words then if words then
DEBUG("search forward: found at page", words.page) DEBUG("search forward: found at page", words.page)
@ -154,38 +154,38 @@ describe("Readersearch module", function()
end) end)
it("should find the first occurrence", function() it("should find the first occurrence", function()
for i = 20, 40, 10 do for i = 20, 40, 10 do
paging:gotoPage(i) paging:onGotoPage(i)
local words = search:searchFromStart("test") local words = search:searchFromStart("test")
assert.truthy(words) assert.truthy(words)
assert.are.equal(10, words.page) assert.are.equal(10, words.page)
end end
for i = 1, 10, 2 do for i = 1, 10, 2 do
paging:gotoPage(i) paging:onGotoPage(i)
local words = search:searchFromStart("test") local words = search:searchFromStart("test")
assert(words == nil) assert(words == nil)
end end
end) end)
it("should find the last occurrence", function() it("should find the last occurrence", function()
for i = 10, 30, 10 do for i = 10, 30, 10 do
paging:gotoPage(i) paging:onGotoPage(i)
local words = search:searchFromEnd("test") local words = search:searchFromEnd("test")
assert.truthy(words) assert.truthy(words)
assert.are.equal(32, words.page) assert.are.equal(32, words.page)
end end
for i = 40, 50, 2 do for i = 40, 50, 2 do
paging:gotoPage(i) paging:onGotoPage(i)
local words = search:searchFromEnd("test") local words = search:searchFromEnd("test")
assert(words == nil) assert(words == nil)
end end
end) end)
it("should find all occurrences", function() it("should find all occurrences", function()
local count = 0 local count = 0
paging:gotoPage(1) paging:onGotoPage(1)
local words = search:searchFromCurrent("test", 0) local words = search:searchFromCurrent("test", 0)
while words do while words do
count = count + #words count = count + #words
--DEBUG("found words", #words, words.page) --DEBUG("found words", #words, words.page)
paging:gotoPage(words.page) paging:onGotoPage(words.page)
words = search:searchNext("test", 0) words = search:searchNext("test", 0)
end end
assert.are.equal(11, count) assert.are.equal(11, count)

@ -1,10 +1,14 @@
require("commonrequire")
local DocumentRegistry = require("document/documentregistry")
local Blitbuffer = require("ffi/blitbuffer")
local ReaderUI = require("apps/reader/readerui")
local UIManager = require("ui/uimanager")
describe("Readerview module", function() describe("Readerview module", function()
local DocumentRegistry, Blitbuffer, ReaderUI, UIManager
setup(function()
require("commonrequire")
DocumentRegistry = require("document/documentregistry")
Blitbuffer = require("ffi/blitbuffer")
ReaderUI = require("apps/reader/readerui")
UIManager = require("ui/uimanager")
end)
it("should stop hinting on document close event", function() it("should stop hinting on document close event", function()
local sample_epub = "spec/front/unit/data/leaves.epub" local sample_epub = "spec/front/unit/data/leaves.epub"
local readerui = ReaderUI:new{ local readerui = ReaderUI:new{

Loading…
Cancel
Save