Skip to content

Commit

Permalink
cover a few more lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed Dec 18, 2023
1 parent 44186b1 commit 7a0e62e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/cairo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ function _init_canvas!(widget, w, h)
end

function _canvas_on_realize(::Ptr, canvas)
if canvas.is_sized
_canvas_on_resize(da,1,1)
end
canvas.is_sized && _canvas_on_resize(da,1,1)
nothing
end

Expand Down Expand Up @@ -120,9 +118,7 @@ end
Return the CairoContext of the `CairoSurface` backing store of a `GtkCanvas`.
"""
function getgc(c::GtkCanvas)
if !isdefined(c,:backcc)
error("GtkCanvas not yet initialized.")
end
isdefined(c,:backcc) || error("GtkCanvas not yet initialized.")
return c.backcc
end

Expand All @@ -132,8 +128,6 @@ end
Return the image `CairoSurface` backing store for a `GtkCanvas`.
"""
function cairo_surface(c::GtkCanvas)
if !isdefined(c,:back)
error("GtkCanvas not yet initialized.")
end
isdefined(c,:back) || error("GtkCanvas not yet initialized.")
return c.back
end
2 changes: 2 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ GtkAdjustment(spinButton::GtkSpinButton) = G_.get_adjustment(spinButton)
GtkAdjustment(range::GtkRange) = G_.get_adjustment(range)
GtkAdjustment(scale::GtkScaleButton) = G_.get_adjustment(scale)

setindex!(buffer::GtkEntryBuffer, content::String, ::Type{String}) =
G_.set_text(buffer, content, -1)
2 changes: 1 addition & 1 deletion src/input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function GtkEntryBuffer(initial_text = nothing)
G_.EntryBuffer_new(initial_text, -1)
end

setindex!(buffer::GtkEntryBuffer, content::String, ::Type{String}) =
setindex!(buffer::GtkEntryBuffer, content::String) =
G_.set_text(buffer, content, -1)

complete(completion::GtkEntryCompletion) = G_.complete(completion)
Expand Down
2 changes: 2 additions & 0 deletions test/gui/input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ set_gtk_property!(e,:sensitive,false)
b = GtkEntryBuffer("different")
buffer(e, b)
@test e.text == "different"
b[] = "new text"
@test e.text == "new text"

@test fraction(e) == 0.0
fraction(e, 1.0)
Expand Down
4 changes: 4 additions & 0 deletions test/gui/window.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ end
w = GtkWindow("Window", 400, 300)
fullscreen(w)
sleep(1)
@static Sys.islinux() && @test Gtk4.isfullscreen(w)
@static Sys.islinux() && @test Gtk4.isrealized(w)
unfullscreen(w)
sleep(1)
maximize(w)
Expand All @@ -51,6 +53,8 @@ end
unmaximize(w)
sleep(1)
@test !G_.is_maximized(w)
ag = GSimpleActionGroup()
push!(w, GActionGroup(ag), "window")
Gtk4.default_size(w, 200, 500)
@test Gtk4.default_size(w) == (200, 500)
destroy(w)
Expand Down

0 comments on commit 7a0e62e

Please sign in to comment.