Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur committed Oct 3, 2024
1 parent e93f07f commit 7193ee2
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion ReferenceTests/src/tests/figures_and_makielayout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,34 @@ end
Makie.Checkbox(f[2, 4], checked = false, checkboxcolor_unchecked = :yellow)
Makie.Checkbox(f[2, 5], checked = true, checkboxcolor_checked = :orange)
f
end
end

@reference_test "Textbox" begin
f = Figure()

tb1 = Makie.Textbox(f[1,1])
Makie.set!(tb1, "1234567890qwertyuiop")
Makie.focus!(tb1)
f.scene.events.mouseposition[] = (297, 221)
f.scene.events.mousebutton[] = Makie.MouseButtonEvent(Makie.Mouse.left, Makie.Mouse.press)
Makie.defocus!(tb1)

tb2 = Makie.Textbox(f[2,1], width=100)
Makie.set!(tb2, "1234567890qwertyuiop")
tb2.cursorindex[] = 20
Makie.focus!(tb2)
f.scene.events.keyboardbutton[] = Makie.KeyEvent(Makie.Keyboard.backspace, Makie.Keyboard.press)
Makie.defocus!(tb2)

tb3 = Makie.Textbox(f[3,1], width=100)
Makie.set!(tb3, "1234567890qwertyuiop")
tb3.cursorindex[] = 20
Makie.focus!(tb3)
f.scene.events.mouseposition[] = (259, 173)
f.scene.events.mousebutton[] = Makie.MouseButtonEvent(Makie.Mouse.left, Makie.Mouse.press)
f.scene.events.keyboardbutton[] = Makie.KeyEvent(Makie.Keyboard.left, Makie.Keyboard.press)
f.scene.events.keyboardbutton[] = Makie.KeyEvent(Makie.Keyboard.left, Makie.Keyboard.press)
Makie.defocus!(tb3)

f
end

0 comments on commit 7193ee2

Please sign in to comment.