tests/readerlink: reorganize

Group tests by file type (EPUB or PDF).
reviewable/pr11781/r2
Benoit Pierre 4 weeks ago committed by Frans de Jonge
parent b67c6147d5
commit d0ca04c48d

@ -14,7 +14,21 @@ describe("ReaderLink module", function()
sample_pdf = "spec/front/unit/data/paper.pdf"
end)
it("should jump to links in epub #nocov", function()
describe("with epub", function()
it("should jump to links #nocov", function()
local readerui = ReaderUI:new{
dimen = Screen:getSize(),
document = DocumentRegistry:openDocument(sample_epub),
}
readerui.rolling:onGotoPage(5)
readerui.link:onTap(nil, {pos = {x = 320, y = 190}})
assert.is.same(37, readerui.rolling.current_page)
readerui:closeDocument()
readerui:onClose()
end)
it("should be able to go back after link jump #nocov", function()
local readerui = ReaderUI:new{
dimen = Screen:getSize(),
document = DocumentRegistry:openDocument(sample_epub),
@ -22,11 +36,17 @@ describe("ReaderLink module", function()
readerui.rolling:onGotoPage(5)
readerui.link:onTap(nil, {pos = {x = 320, y = 190}})
assert.is.same(37, readerui.rolling.current_page)
readerui.link:onGoBackLink()
assert.is.same(5, readerui.rolling.current_page)
readerui:closeDocument()
readerui:onClose()
end)
it("should jump to links in pdf page mode", function()
end)
describe("with pdf", function()
it("should jump to links in page mode", function()
UIManager:quit()
UIManager._exit_code = nil
local readerui = ReaderUI:new{
@ -43,7 +63,7 @@ describe("ReaderLink module", function()
readerui:onClose()
end)
it("should jump to links in pdf scroll mode", function()
it("should jump to links in scroll mode", function()
UIManager:quit()
UIManager._exit_code = nil
local readerui = ReaderUI:new{
@ -64,21 +84,7 @@ describe("ReaderLink module", function()
readerui:onClose()
end)
it("should be able to go back after link jump in epub #nocov", function()
local readerui = ReaderUI:new{
dimen = Screen:getSize(),
document = DocumentRegistry:openDocument(sample_epub),
}
readerui.rolling:onGotoPage(5)
readerui.link:onTap(nil, {pos = {x = 320, y = 190}})
assert.is.same(37, readerui.rolling.current_page)
readerui.link:onGoBackLink()
assert.is.same(5, readerui.rolling.current_page)
readerui:closeDocument()
readerui:onClose()
end)
it("should be able to go back after link jump in pdf page mode", function()
it("should be able to go back after link jump in page mode", function()
UIManager:quit()
UIManager._exit_code = nil
local readerui = ReaderUI:new{
@ -97,7 +103,7 @@ describe("ReaderLink module", function()
readerui:onClose()
end)
it("should be able to go back after link jump in pdf scroll mode", function()
it("should be able to go back after link jump in scroll mode", function()
UIManager:quit()
UIManager._exit_code = nil
local readerui = ReaderUI:new{
@ -118,7 +124,7 @@ describe("ReaderLink module", function()
readerui:onClose()
end)
it("should be able to go back to the same position after link jump in pdf scroll mode", function()
it("should be able to go back to the same position after link jump in scroll mode", function()
UIManager:quit()
UIManager._exit_code = nil
local expected_page_states = {
@ -195,4 +201,6 @@ describe("ReaderLink module", function()
readerui:closeDocument()
readerui:onClose()
end)
end)
end)

Loading…
Cancel
Save