Update readerhighlight_spec.lua

reviewable/pr11563/r8
hius07 1 month ago committed by GitHub
parent 4667ddc48a
commit 37eedddce7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -17,7 +17,7 @@ describe("Readerhighlight module", function()
readerui.highlight:onHold(nil, { pos = pos0 })
readerui.highlight:onHoldRelease()
readerui.highlight:onHighlight()
readerui.highlight:saveHighlight()
assert.spy(s).was_called()
assert.spy(s).was_called_with(match.is_ref(readerui.languagesupport),
@ -50,7 +50,7 @@ describe("Readerhighlight module", function()
assert.truthy(readerui.highlight.highlight_dialog)
assert.truthy(UIManager._window_stack[next_slot].widget
== readerui.highlight.highlight_dialog)
readerui.highlight:onHighlight()
readerui.highlight:saveHighlight()
UIManager:scheduleIn(1, function()
UIManager:close(readerui.highlight.highlight_dialog)
UIManager:close(readerui)
@ -64,7 +64,7 @@ describe("Readerhighlight module", function()
readerui.highlight:onHold(nil, { pos = pos0 })
readerui.highlight:onHoldPan(nil, { pos = pos1 })
readerui.highlight:onHoldRelease()
readerui.highlight:onHighlight()
readerui.highlight:saveHighlight()
readerui.highlight:clear()
UIManager:close(readerui.highlight.highlight_dialog)
readerui.highlight:onTap(nil, { pos = pos2 })
@ -111,7 +111,7 @@ describe("Readerhighlight module", function()
highlight_single_word(readerui, Geom:new{ x = 400, y = 70 })
Screen:shot("screenshots/reader_highlight_single_word_epub.png")
assert.spy(selection_spy).was_called()
assert.truthy(readerui.view.highlight.saved[page])
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should highlight text", function()
highlight_text(readerui,
@ -119,7 +119,7 @@ describe("Readerhighlight module", function()
Geom:new{ x = 400, y = 170 })
Screen:shot("screenshots/reader_highlight_text_epub.png")
assert.spy(selection_spy).was_called()
assert.truthy(readerui.view.highlight.saved[page])
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should response on tap gesture", function()
tap_highlight_text(readerui,
@ -165,10 +165,12 @@ describe("Readerhighlight module", function()
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })
Screen:shot("screenshots/reader_highlight_single_word_pdf.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should highlight text", function()
highlight_text(readerui, Geom:new{ x = 260, y = 170 }, Geom:new{ x = 260, y = 250 })
Screen:shot("screenshots/reader_highlight_text_pdf.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
end)
describe("for scanned page without text layer", function()
@ -187,10 +189,12 @@ describe("Readerhighlight module", function()
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })
Screen:shot("screenshots/reader_highlight_single_word_pdf_scanned.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should highlight text", function()
highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 })
Screen:shot("screenshots/reader_highlight_text_pdf_scanned.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
end)
describe("for reflowed page", function()
@ -214,10 +218,12 @@ describe("Readerhighlight module", function()
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })
Screen:shot("screenshots/reader_highlight_single_word_pdf_reflowed.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should highlight text", function()
highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 })
Screen:shot("screenshots/reader_highlight_text_pdf_reflowed.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
end)
end)
@ -255,6 +261,7 @@ describe("Readerhighlight module", function()
it("should highlight text", function()
highlight_text(readerui, Geom:new{ x = 260, y = 170 }, Geom:new{ x = 260, y = 250 })
Screen:shot("screenshots/reader_highlight_text_pdf_scroll.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should response on tap gesture", function()
tap_highlight_text(readerui,
@ -262,6 +269,7 @@ describe("Readerhighlight module", function()
Geom:new{ x = 260, y = 150 },
Geom:new{ x = 280, y = 110 })
Screen:shot("screenshots/reader_tap_highlight_text_pdf_scroll.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
end)
describe("for scanned page without text layer", function()
@ -277,10 +285,12 @@ describe("Readerhighlight module", function()
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })
Screen:shot("screenshots/reader_highlight_single_word_pdf_scanned_scroll.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should highlight text", function()
highlight_text(readerui, Geom:new{x = 192, y = 186}, Geom:new{x = 280, y = 186})
Screen:shot("screenshots/reader_highlight_text_pdf_scanned_scroll.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should response on tap gesture", function()
tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 })
@ -304,10 +314,12 @@ describe("Readerhighlight module", function()
it("should highlight single word", function()
highlight_single_word(readerui, Geom:new{ x = 260, y = 70 })
Screen:shot("screenshots/reader_highlight_single_word_pdf_reflowed_scroll.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should highlight text", function()
highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 })
Screen:shot("screenshots/reader_highlight_text_pdf_reflowed_scroll.png")
assert.truthy(#readerui.annotation.annotations == 1)
end)
it("should response on tap gesture", function()
tap_highlight_text(readerui, Geom:new{ x = 260, y = 70 }, Geom:new{ x = 260, y = 150 }, Geom:new{ x = 280, y = 110 })

Loading…
Cancel
Save