Merge pull request #2664 from psychon/naughty_test_print_warning
Some changes to the new naughty test
This commit is contained in:
commit
e7a67d300e
|
@ -44,7 +44,14 @@ check_cmd()
|
|||
|
||||
-- Can't test anything of value the documentation example tests don't already
|
||||
-- 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
|
||||
|
||||
|
@ -81,7 +88,7 @@ naughty.connect_signal("destroyed", destroyed_callback)
|
|||
table.insert(steps, function()
|
||||
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
|
||||
end)
|
||||
|
@ -121,7 +128,7 @@ table.insert(steps, function()
|
|||
-- There is some magic behind this, check it works
|
||||
assert(naughty.suspended)
|
||||
|
||||
spawn('notify-send title message -t 25000')
|
||||
spawn{ 'notify-send', 'title', 'message', '-t', '25000' }
|
||||
|
||||
return true
|
||||
end)
|
||||
|
@ -143,7 +150,7 @@ table.insert(steps, function(count)
|
|||
active[1]:destroy()
|
||||
assert(#active == 0)
|
||||
|
||||
spawn('notify-send title message -t 1')
|
||||
spawn{ 'notify-send', 'title', 'message', '-t', '1' }
|
||||
|
||||
return true
|
||||
end)
|
||||
|
@ -168,7 +175,7 @@ table.insert(steps, function()
|
|||
-- There is some magic behind this, make sure it works
|
||||
assert(naughty.expiration_paused)
|
||||
|
||||
spawn('notify-send title message -t 1')
|
||||
spawn{ 'notify-send', 'title', 'message', '-t', '1' }
|
||||
|
||||
return true
|
||||
end)
|
||||
|
@ -202,9 +209,9 @@ table.insert(steps, function()
|
|||
-- so better not "document" the instantaneous clearing of the queue.
|
||||
if #active > 0 then return end
|
||||
|
||||
spawn('notify-send low message -t 25000 -u low')
|
||||
spawn('notify-send normal message -t 25000 -u normal')
|
||||
spawn('notify-send critical message -t 25000 -u critical')
|
||||
spawn{ 'notify-send', 'low', 'message', '-t', '25000', '-u', 'low' }
|
||||
spawn{ 'notify-send', 'normal', 'message', '-t', '25000', '-u', 'normal' }
|
||||
spawn{ 'notify-send', 'critical', 'message', '-t', '25000', '-u', 'critical' }
|
||||
|
||||
return true
|
||||
end)
|
||||
|
@ -229,7 +236,7 @@ table.insert(steps, function()
|
|||
-- Everything should fit, otherwise the math is wrong in
|
||||
-- `neughty.layout.legacy` and its a regression.
|
||||
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
|
||||
|
||||
return true
|
||||
|
@ -278,7 +285,7 @@ table.insert(steps, function()
|
|||
|
||||
-- Now add even more!
|
||||
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
|
||||
|
||||
return true
|
||||
|
@ -559,20 +566,21 @@ end)
|
|||
-- Test more advanced features than what notify-send can provide.
|
||||
if has_cmd_send then
|
||||
|
||||
local cmd = [[dbus-send \
|
||||
--type=method_call \
|
||||
--print-reply=literal \
|
||||
--dest=org.freedesktop.Notifications \
|
||||
/org/freedesktop/Notifications \
|
||||
org.freedesktop.Notifications.Notify \
|
||||
string:"Awesome test" \
|
||||
uint32:0 \
|
||||
string:"" \
|
||||
string:"title" \
|
||||
string:"message body" \
|
||||
array:string:1,"one",2,"two",3,"three" \
|
||||
dict:string:string:"","" \
|
||||
int32:25000]]
|
||||
local cmd = { 'dbus-send',
|
||||
'--type=method_call',
|
||||
'--print-reply=literal',
|
||||
'--dest=org.freedesktop.Notifications',
|
||||
'/org/freedesktop/Notifications',
|
||||
'org.freedesktop.Notifications.Notify',
|
||||
'string:"Awesome test"',
|
||||
'uint32:0',
|
||||
'string:""',
|
||||
'string:"title"',
|
||||
'string:"message body"',
|
||||
'array:string:1,one,2,two,3,three',
|
||||
'dict:string:string:"",""',
|
||||
'int32:25000'
|
||||
}
|
||||
|
||||
-- Test the actions.
|
||||
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::actions", function() actions_u = true end)
|
||||
|
||||
local update = [[dbus-send \
|
||||
--type=method_call \
|
||||
--print-reply=literal \
|
||||
--dest=org.freedesktop.Notifications \
|
||||
/org/freedesktop/Notifications \
|
||||
org.freedesktop.Notifications.Notify \
|
||||
string:"Awesome test" \
|
||||
uint32:]].. nid ..[[ \
|
||||
string:"" \
|
||||
string:"updated title" \
|
||||
string:"updated message body" \
|
||||
array:string:1,"four",2,"five",3,"six" \
|
||||
dict:string:string:"","" \
|
||||
int32:25000]]
|
||||
local update = { 'dbus-send',
|
||||
'--type=method_call',
|
||||
'--print-reply=literal',
|
||||
'--dest=org.freedesktop.Notifications',
|
||||
'/org/freedesktop/Notifications',
|
||||
'org.freedesktop.Notifications.Notify',
|
||||
'string:"Awesome test"',
|
||||
'uint32:' .. nid,
|
||||
'string:""',
|
||||
'string:updated title',
|
||||
'string:updated message body',
|
||||
'array:string:1,four,2,five,3,six',
|
||||
'dict:string:string:"",""',
|
||||
'int32:25000',
|
||||
}
|
||||
|
||||
spawn(update)
|
||||
|
||||
|
|
Loading…
Reference in New Issue