Skip to content

Commit

Permalink
split tests up
Browse files Browse the repository at this point in the history
trying to isolate the problem
  • Loading branch information
jwahlstrand committed Nov 5, 2023
1 parent 4640b92 commit 8560ee5
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions test/action-group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,37 +108,54 @@ GLib.signal_handler_disconnect(g, id)

@test ["do-something"] == GLib.list_actions(GActionGroup(g))

delete!(g, "do-something")

end

@testset "add action cfunction" begin
g=GLib.G_.SimpleActionGroup_new()
extra_arg_ref=Ref(0)

action_added = Ref(false)

function action_added_cb2(action_group, action_name, extra_arg)
action_added[] = true
extra_arg_ref[] = extra_arg
nothing
end

delete!(g, "do-something")

# test the more sophisticated `signal_connect`
GLib.on_action_added(action_added_cb2, g, 3)

# while we're at it, test `add_action`
function cb(ac,va)
nothing
end

add_action(GActionMap(g), "new-action", cb)

@test extra_arg_ref[] == 3
#@test extra_arg_ref[] == 3

function cb2(a,v,user_data)
nothing
end

add_action(GActionMap(g), "new-action2", cb2, 4)
end

# test `add_stateful_action`
@testset "add stateful action" begin

g=GLib.G_.SimpleActionGroup_new()

function cb(ac,va)
nothing
end

a5 = add_stateful_action(GActionMap(g), "new-action3", true, cb)

function cb2(a,v,user_data)
nothing
end

add_stateful_action(GActionMap(g), "new-action4", true, cb2, 5)

@test a5.state == GVariant(true)
Expand Down

0 comments on commit 8560ee5

Please sign in to comment.