From 7193ee2e4cd6c05e9875e920a8d474a13625df09 Mon Sep 17 00:00:00 2001 From: Ben Arthur Date: Tue, 1 Oct 2024 19:08:08 -0400 Subject: [PATCH] add tests --- .../src/tests/figures_and_makielayout.jl | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ReferenceTests/src/tests/figures_and_makielayout.jl b/ReferenceTests/src/tests/figures_and_makielayout.jl index b61da7b1348..6cf4e80c6de 100644 --- a/ReferenceTests/src/tests/figures_and_makielayout.jl +++ b/ReferenceTests/src/tests/figures_and_makielayout.jl @@ -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 \ No newline at end of file +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