From a19b09827fea77d5c7aa4f71b904e44b18f25ccd Mon Sep 17 00:00:00 2001 From: Jared Wahlstrand Date: Sat, 8 Jul 2023 17:58:00 -0400 Subject: [PATCH] test improvements try to destroy all windows --- test/action-group.jl | 4 ++-- test/gui.jl | 16 ++++++++++++++-- test/gui/dialogs.jl | 1 + test/gui/examples.jl | 6 ++++++ test/gui/layout.jl | 1 + test/test.ui | 2 +- test/tree.jl | 2 ++ 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/test/action-group.jl b/test/action-group.jl index 48ddb01b..9808aba6 100644 --- a/test/action-group.jl +++ b/test/action-group.jl @@ -3,10 +3,9 @@ using Test # GSimpleAction is an object with properties -a=GLib.G_.SimpleAction_new("do-something",nothing) - @testset "gaction" begin +a=GLib.G_.SimpleAction_new("do-something",nothing) g=GLib.G_.SimpleActionGroup_new() @test isa(g,GSimpleActionGroup) @@ -79,6 +78,7 @@ end @testset "GListStore" begin +a=GLib.G_.SimpleAction_new("do-something",nothing) l = GListStore(:GSimpleAction) @test length(l)==0 push!(l, a) diff --git a/test/gui.jl b/test/gui.jl index e4987e0c..cc1ea865 100644 --- a/test/gui.jl +++ b/test/gui.jl @@ -34,6 +34,7 @@ hide(w) show(w) grab_focus(w) close(w) +destroy(w) end @@ -86,6 +87,7 @@ end @test w.cursor === nothing destroy(w) + destroy(w2) end @testset "change Window size" begin @@ -131,6 +133,8 @@ end push!(wg,w2) delete!(wg,w1) delete!(wg,w2) + destroy(w1) + destroy(w2) end @testset "Initially Hidden Canvas" begin @@ -316,6 +320,8 @@ cb1.active = true cb2.active = true @test cb1.active == true +destroy(w) + end @testset "togglebuttons in group" begin @@ -341,6 +347,8 @@ tb1.active = true tb2.active = true @test tb1.active == true +destroy(w) + end @testset "switch and togglebutton" begin @@ -533,7 +541,7 @@ end @testset "Statusbar" begin vbox = GtkBox(:v) w = GtkWindow(vbox, "Statusbar") -global sb = GtkStatusbar() +sb = GtkStatusbar() push!(vbox, sb) ctxid = Gtk4.context_id(sb, "Statusbar example") bpush = GtkButton("push item") @@ -591,13 +599,16 @@ button = b["a_button"] @load_builder(b) +destroy(a_window) + @test button == b["a_button"] s = open("test.ui","r") do f read(f,String) end b3 = GtkBuilder(s,-1) - +win = b3["a_window"] +destroy(win) end @@ -653,6 +664,7 @@ end @test mtrx.yy == 280 @test mtrx.xy == mtrx.yx == mtrx.x0 == mtrx.y0 == 0 surf = Gtk4.cairo_surface(cnvs) + destroy(win) end @testset "GLArea" begin diff --git a/test/gui/dialogs.jl b/test/gui/dialogs.jl index 5ba8ea62..8fd8dddf 100644 --- a/test/gui/dialogs.jl +++ b/test/gui/dialogs.jl @@ -25,5 +25,6 @@ dlg = GtkDialog("General dialog", Gtk4.DialogFlags_MODAL ) show(dlg) destroy(dlg) +destroy(main_window) end diff --git a/test/gui/examples.jl b/test/gui/examples.jl index 2c3ecc41..bed7813c 100644 --- a/test/gui/examples.jl +++ b/test/gui/examples.jl @@ -7,26 +7,32 @@ using Test, Gtk4 activate(b2) sleep(0.5) activate(b) + destroy(win) end @testset "Calculator" begin include(joinpath(@__DIR__, "..", "..", "examples", "calculator4.jl")) + destroy(win) end @testset "List View" begin include(joinpath(@__DIR__, "..", "..", "examples", "listview.jl")) + destroy(win) end @testset "GL Area" begin include(joinpath(@__DIR__, "..", "..", "examples", "glarea.jl")) + destroy(w) end @testset "Cairo canvas" begin include(joinpath(@__DIR__, "..", "..", "examples", "canvas.jl")) + destroy(win) end @testset "Dialogs" begin include(joinpath(@__DIR__, "..", "..", "examples", "dialogs.jl")) + destroy(main_window) end end diff --git a/test/gui/layout.jl b/test/gui/layout.jl index 46b6ce0c..b629d42e 100644 --- a/test/gui/layout.jl +++ b/test/gui/layout.jl @@ -114,6 +114,7 @@ end l4 = GtkLabel("Named #2") s["named2"] = l4 @test s["named2"] == l4 + destroy(w) end @testset "overlay" begin diff --git a/test/test.ui b/test/test.ui index e53453f5..2272f2fd 100644 --- a/test/test.ui +++ b/test/test.ui @@ -6,7 +6,7 @@ 1 10 - + vertical diff --git a/test/tree.jl b/test/tree.jl index 0a919555..e22cda3b 100644 --- a/test/tree.jl +++ b/test/tree.jl @@ -133,4 +133,6 @@ splice!(store, [4]) empty!(store) empty!(cols[1]) +destroy(window) + end