Prevent Busted from blowing up on cdata finalizers by properly closing

opened documents...
This commit is contained in:
NiLuJe
2020-12-19 05:32:23 +01:00
parent 0ab4023150
commit 9cda84ef2f
16 changed files with 155 additions and 20 deletions

View File

@@ -22,6 +22,8 @@ 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:closeDocument()
readerui:onClose()
end)
it("should jump to links in pdf page mode", function()
@@ -36,6 +38,8 @@ describe("ReaderLink module", function()
readerui.link:onTap(nil, {pos = {x = 363, y = 565}})
UIManager:run()
assert.is.same(22, readerui.paging.current_page)
readerui:closeDocument()
readerui:onClose()
end)
it("should jump to links in pdf scroll mode", function()
@@ -54,6 +58,8 @@ describe("ReaderLink module", function()
-- page positions may have unexpected impact on page number
assert.truthy(readerui.paging.current_page == 21
or readerui.paging.current_page == 20)
readerui:closeDocument()
readerui:onClose()
end)
it("should be able to go back after link jump in epub #nocov", function()
@@ -66,6 +72,8 @@ describe("ReaderLink module", function()
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()
@@ -82,6 +90,8 @@ describe("ReaderLink module", function()
assert.is.same(22, readerui.paging.current_page)
readerui.link:onGoBackLink()
assert.is.same(1, readerui.paging.current_page)
readerui:closeDocument()
readerui:onClose()
end)
it("should be able to go back after link jump in pdf scroll mode", function()
@@ -100,6 +110,8 @@ describe("ReaderLink module", function()
or readerui.paging.current_page == 20)
readerui.link:onGoBackLink()
assert.is.same(1, readerui.paging.current_page)
readerui:closeDocument()
readerui:onClose()
end)
it("should be able to go back to the same position after link jump in pdf scroll mode", function()
@@ -175,5 +187,7 @@ describe("ReaderLink module", function()
readerui.link:onGoBackLink()
assert.is.same(3, readerui.paging.current_page)
assert.are.same(expected_page_states, readerui.view.page_states)
readerui:closeDocument()
readerui:onClose()
end)
end)