Add failing test: c.startup_id should be nil when snid is disabled

When using `spawn` without startup notification support, the
`startup_id` property on the client should be nil.

This adds rxvt-unicode to the Travis build, because it supports startup
notifications, but xterm does not.  We should replace xterm with it in
the existing tests then later.
This commit is contained in:
Daniel Hahler 2015-10-28 01:00:00 +01:00
parent 9afb2578f8
commit 339e2b0ecc
2 changed files with 43 additions and 1 deletions

View File

@ -31,7 +31,7 @@ install:
- sudo apt-get install -y libcairo2-dev xmlto asciidoc libpango1.0-dev gperf luadoc libxcb-xtest0-dev libxcb-icccm4-dev libxcb-randr0-dev libxcb-keysyms1-dev libxcb-xinerama0-dev libxcb-image0-dev libev-dev libimlib2-dev libdbus-1-dev libxdg-basedir-dev libstartup-notification0-dev imagemagick libxcb1-dev libxcb-shape0-dev libxcb-util0-dev libxcursor-dev libx11-xcb-dev libxcb-cursor-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev - sudo apt-get install -y libcairo2-dev xmlto asciidoc libpango1.0-dev gperf luadoc libxcb-xtest0-dev libxcb-icccm4-dev libxcb-randr0-dev libxcb-keysyms1-dev libxcb-xinerama0-dev libxcb-image0-dev libev-dev libimlib2-dev libdbus-1-dev libxdg-basedir-dev libstartup-notification0-dev imagemagick libxcb1-dev libxcb-shape0-dev libxcb-util0-dev libxcursor-dev libx11-xcb-dev libxcb-cursor-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
# Deps for functional tests. # Deps for functional tests.
- sudo apt-get install -y dbus-x11 xterm xdotool xterm xvfb - sudo apt-get install -y dbus-x11 xterm xdotool xterm xvfb rxvt-unicode
# Install Lua (per env). # Install Lua (per env).
- sudo apt-get install -y lib${LUANAME}-dev ${LUANAME} ${INSTALL_PKGS} - sudo apt-get install -y lib${LUANAME}-dev ${LUANAME} ${INSTALL_PKGS}

42
tests/test-spawn-snid.lua Normal file
View File

@ -0,0 +1,42 @@
--- Tests for spawn's startup notifications.
local spawn = require("awful.spawn")
local manage_called, c_snid
client.connect_signal("manage", function(c)
manage_called = true
c_snid = c.startup_id
end)
local ret, snid
local steps = {
function(count)
if count == 1 then
ret, snid = spawn('urxvt', true)
elseif manage_called then
local c = client.get()[1]
assert(ret)
assert(snid)
assert(snid == c_snid)
return true
end
end,
-- Test that c.startup_id is nil for a client without startup notifications,
-- and especially not the one from the previous spawn.
function(count)
if count == 1 then
manage_called = false
ret, snid = spawn('urxvt', false)
elseif manage_called then
assert(ret)
assert(snid == nil)
assert(c_snid == nil, "c.startup_snid should be nil!")
return true
end
end
}
require("_runner").run_steps(steps)