Merge pull request #2664 from psychon/naughty_test_print_warning

Some changes to the new naughty test
This commit is contained in:
mergify[bot] 2019-02-18 01:33:14 +00:00 committed by GitHub
commit e7a67d300e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 38 deletions

View File

@ -44,7 +44,14 @@ check_cmd()
-- Can't test anything of value the documentation example tests don't already -- Can't test anything of value the documentation example tests don't already
-- hit. -- hit.
if not has_cmd_send then require("_runner").run_steps {}; return end if not has_cmd_send then
require("gears.debug").print_warning("Did not find dbus-send, skipping test")
require("_runner").run_steps {}
return
end
if not has_cmd_notify then
require("gears.debug").print_warning("Did not find notify-send, skipping some tests")
end
local active, destroyed, reasons, counter = {}, {}, {}, 0 local active, destroyed, reasons, counter = {}, {}, {}, 0
@ -81,7 +88,7 @@ naughty.connect_signal("destroyed", destroyed_callback)
table.insert(steps, function() table.insert(steps, function()
if not has_cmd_notify then return true end if not has_cmd_notify then return true end
spawn('notify-send title message -t 25000') spawn{ 'notify-send', 'title', 'message', '-t', '25000' }
return true return true
end) end)
@ -121,7 +128,7 @@ table.insert(steps, function()
-- There is some magic behind this, check it works -- There is some magic behind this, check it works
assert(naughty.suspended) assert(naughty.suspended)
spawn('notify-send title message -t 25000') spawn{ 'notify-send', 'title', 'message', '-t', '25000' }
return true return true
end) end)
@ -143,7 +150,7 @@ table.insert(steps, function(count)
active[1]:destroy() active[1]:destroy()
assert(#active == 0) assert(#active == 0)
spawn('notify-send title message -t 1') spawn{ 'notify-send', 'title', 'message', '-t', '1' }
return true return true
end) end)
@ -168,7 +175,7 @@ table.insert(steps, function()
-- There is some magic behind this, make sure it works -- There is some magic behind this, make sure it works
assert(naughty.expiration_paused) assert(naughty.expiration_paused)
spawn('notify-send title message -t 1') spawn{ 'notify-send', 'title', 'message', '-t', '1' }
return true return true
end) end)
@ -202,9 +209,9 @@ table.insert(steps, function()
-- so better not "document" the instantaneous clearing of the queue. -- so better not "document" the instantaneous clearing of the queue.
if #active > 0 then return end if #active > 0 then return end
spawn('notify-send low message -t 25000 -u low') spawn{ 'notify-send', 'low', 'message', '-t', '25000', '-u', 'low' }
spawn('notify-send normal message -t 25000 -u normal') spawn{ 'notify-send', 'normal', 'message', '-t', '25000', '-u', 'normal' }
spawn('notify-send critical message -t 25000 -u critical') spawn{ 'notify-send', 'critical', 'message', '-t', '25000', '-u', 'critical' }
return true return true
end) end)
@ -229,7 +236,7 @@ table.insert(steps, function()
-- Everything should fit, otherwise the math is wrong in -- Everything should fit, otherwise the math is wrong in
-- `neughty.layout.legacy` and its a regression. -- `neughty.layout.legacy` and its a regression.
for i=1, max_notif do for i=1, max_notif do
spawn('notify-send "notif '..i..'" message -t 25000 -u low') spawn{ 'notify-send', 'notif '..i, 'message', '-t', '25000', '-u', 'low' }
end end
return true return true
@ -278,7 +285,7 @@ table.insert(steps, function()
-- Now add even more! -- Now add even more!
for i=1, 5 do for i=1, 5 do
spawn('notify-send "notif '..i..'" message -t 25000 -u low') spawn{ 'notify-send', 'notif '..i, 'message', '-t', '25000', '-u', 'low' }
end end
return true return true
@ -559,20 +566,21 @@ end)
-- Test more advanced features than what notify-send can provide. -- Test more advanced features than what notify-send can provide.
if has_cmd_send then if has_cmd_send then
local cmd = [[dbus-send \ local cmd = { 'dbus-send',
--type=method_call \ '--type=method_call',
--print-reply=literal \ '--print-reply=literal',
--dest=org.freedesktop.Notifications \ '--dest=org.freedesktop.Notifications',
/org/freedesktop/Notifications \ '/org/freedesktop/Notifications',
org.freedesktop.Notifications.Notify \ 'org.freedesktop.Notifications.Notify',
string:"Awesome test" \ 'string:"Awesome test"',
uint32:0 \ 'uint32:0',
string:"" \ 'string:""',
string:"title" \ 'string:"title"',
string:"message body" \ 'string:"message body"',
array:string:1,"one",2,"two",3,"three" \ 'array:string:1,one,2,two,3,three',
dict:string:string:"","" \ 'dict:string:string:"",""',
int32:25000]] 'int32:25000'
}
-- Test the actions. -- Test the actions.
table.insert(steps, function() table.insert(steps, function()
@ -625,20 +633,21 @@ if has_cmd_send then
n:connect_signal("property::message", function() message_u = true end) n:connect_signal("property::message", function() message_u = true end)
n:connect_signal("property::actions", function() actions_u = true end) n:connect_signal("property::actions", function() actions_u = true end)
local update = [[dbus-send \ local update = { 'dbus-send',
--type=method_call \ '--type=method_call',
--print-reply=literal \ '--print-reply=literal',
--dest=org.freedesktop.Notifications \ '--dest=org.freedesktop.Notifications',
/org/freedesktop/Notifications \ '/org/freedesktop/Notifications',
org.freedesktop.Notifications.Notify \ 'org.freedesktop.Notifications.Notify',
string:"Awesome test" \ 'string:"Awesome test"',
uint32:]].. nid ..[[ \ 'uint32:' .. nid,
string:"" \ 'string:""',
string:"updated title" \ 'string:updated title',
string:"updated message body" \ 'string:updated message body',
array:string:1,"four",2,"five",3,"six" \ 'array:string:1,four,2,five,3,six',
dict:string:string:"","" \ 'dict:string:string:"",""',
int32:25000]] 'int32:25000',
}
spawn(update) spawn(update)