Skip to content

Commit

Permalink
test improvements
Browse files Browse the repository at this point in the history
try to destroy all windows
  • Loading branch information
jwahlstrand committed Jul 8, 2023
1 parent 409b2d0 commit a19b098
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/action-group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 14 additions & 2 deletions test/gui.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ hide(w)
show(w)
grab_focus(w)
close(w)
destroy(w)

end

Expand Down Expand Up @@ -86,6 +87,7 @@ end
@test w.cursor === nothing

destroy(w)
destroy(w2)
end

@testset "change Window size" begin
Expand Down Expand Up @@ -131,6 +133,8 @@ end
push!(wg,w2)
delete!(wg,w1)
delete!(wg,w2)
destroy(w1)
destroy(w2)
end

@testset "Initially Hidden Canvas" begin
Expand Down Expand Up @@ -316,6 +320,8 @@ cb1.active = true
cb2.active = true
@test cb1.active == true

destroy(w)

end

@testset "togglebuttons in group" begin
Expand All @@ -341,6 +347,8 @@ tb1.active = true
tb2.active = true
@test tb1.active == true

destroy(w)

end

@testset "switch and togglebutton" begin
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/gui/dialogs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ dlg = GtkDialog("General dialog",
Gtk4.DialogFlags_MODAL )
show(dlg)
destroy(dlg)
destroy(main_window)

end
6 changes: 6 additions & 0 deletions test/gui/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions test/gui/layout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ end
l4 = GtkLabel("Named #2")
s["named2"] = l4
@test s["named2"] == l4
destroy(w)
end

@testset "overlay" begin
Expand Down
2 changes: 1 addition & 1 deletion test/test.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkWindow">
<object class="GtkWindow" id="a_window">
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
Expand Down
2 changes: 2 additions & 0 deletions test/tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ splice!(store, [4])
empty!(store)
empty!(cols[1])

destroy(window)

end

0 comments on commit a19b098

Please sign in to comment.