tests: Test the notification icon theme request::icon support.

This commit is contained in:
Emmanuel Lepage Vallee 2019-07-17 03:09:06 -04:00
parent 4fe05a566d
commit 6761778830
1 changed files with 49 additions and 0 deletions

View File

@ -674,6 +674,9 @@ table.insert(steps, function()
assert(n.actions[2].name == "five" )
assert(n.actions[3].name == "six" )
n:destroy()
assert(#active == 0)
return true
end)
@ -815,6 +818,52 @@ table.insert(steps, function()
return true
end)
local icon_requests = {}
-- Check if the action icon support is detected.
table.insert(steps, function()
assert(#active == 0)
naughty.connect_signal("request::icon", function(a, icon_name)
icon_requests[icon_name] = a
a.icon = icon_name == "list-add" and small_icon or big_icon
end)
local hints = {
["action-icons"] = GLib.Variant("b", true),
}
send_notify("Awesome test", 0, "", "title", "message body",
{ "list-add", "add", "list-remove", "remove" }, hints, 25000)
return true
end)
table.insert(steps, function()
if #active ~= 1 then return end
local n = active[1]
assert(n._private.freedesktop_hints)
assert(n._private.freedesktop_hints["action-icons"] == true)
assert(icon_requests["list-add" ] == n.actions[1])
assert(icon_requests["list-remove"] == n.actions[2])
assert(n.actions[1].icon == small_icon)
assert(n.actions[2].icon == big_icon )
assert(type(n.actions[1].position) == "number")
assert(type(n.actions[2].position) == "number")
assert(n.actions[1].position == 1)
assert(n.actions[2].position == 2)
n:destroy()
return true
end)
-- Now check if the old deprecated (but still supported) APIs don't have errors.
table.insert(steps, function()
-- Tests are (by default) not allowed to call deprecated APIs