Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed Aug 25, 2023
1 parent 90b2870 commit c19e976
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/dialogs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ input_dialog_button = GtkButton("Input dialog")
push!(box, input_dialog_button)

function open_input_dialog(b)
input_dialog("Enter your information", "") do t
input_dialog("Enter your information", "", (("Cancel", 0), ("Accept", 1)), main_window) do t
@async println("response was ",t)
end
end
Expand Down
4 changes: 1 addition & 3 deletions src/displays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ function screen_size(widget=nothing)
d=G_.get_display(widget)
else
d=G_.get_default() # gdk_display_get_default
if d===nothing
error("No default display, no way to return screen_size")
end
d===nothing && error("No default display, no way to return screen_size")
end

m=G_.get_monitors(d)
Expand Down
5 changes: 5 additions & 0 deletions test/gui/displays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ pic2 = GtkPicture(pb)
texture = GdkTexture(pb)
@test width(texture)==100
@test height(texture)==100

# test ambiguous constructor handling
@test_throws ErrorException GtkPicture(nothing)
@test_throws ErrorException GtkImage(nothing)
@test_throws ErrorException GtkVideo(nothing)
end

@testset "progressbar" begin
Expand Down
7 changes: 6 additions & 1 deletion test/gui/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ end
include(joinpath(@__DIR__, "..", "..", "examples", "dialogs.jl"))
destroy(main_window)
end


@testset "Listbox" begin
include(joinpath(@__DIR__, "..", "..", "examples", "listbox.jl"))
destroy(main_window)
end

end
3 changes: 3 additions & 0 deletions test/gui/listviews.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ win = GtkWindow("Listview demo")
sw = GtkScrolledWindow()
push!(win, sw)

slist0 = GtkStringList()
@test length(slist0) == 0

slist = GtkStringList(["Apple","Orange","Kiwi"])
model = GLib.GListModel(slist)
push!(slist, "Mango")
Expand Down
7 changes: 7 additions & 0 deletions test/gui/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ b12 = GtkButton(:mnemonic,"_second")
push!(g1, b12)
b21 = GtkButton(:label,"first")
b22 = GtkButton(:icon_name,"document-open-symbolic")
@test_throws ErrorException GtkButton(:shiny,"shiny")
push!(g2, b22)
pushfirst!(g2, b21)
push!(g2, GtkSeparator(:h))
Expand Down Expand Up @@ -151,6 +152,12 @@ b3 = GtkBuilder(s,-1)
win = b3["a_window"]
destroy(win)

b4 = GtkBuilder()
push!(b4; filename="test.ui")

b5 = GtkBuilder()
push!(b5; buffer=s)

end

@testset "CssProviderLeaf(filename=\"...\")" begin
Expand Down
File renamed without changes.

0 comments on commit c19e976

Please sign in to comment.