2017-06-14 09:41:30 +02:00
|
|
|
-- Test the menubar
|
|
|
|
|
|
|
|
local runner = require("_runner")
|
|
|
|
local menubar = require("menubar")
|
|
|
|
|
2017-07-02 23:25:04 +02:00
|
|
|
local menubar_refreshed = false
|
|
|
|
local orig_refresh = menubar.refresh
|
|
|
|
function menubar.refresh(...)
|
|
|
|
menubar_refreshed = true
|
|
|
|
orig_refresh(...)
|
|
|
|
end
|
|
|
|
|
2017-06-23 11:31:54 +02:00
|
|
|
-- XXX We are building Lua 5.3 with -DLUA_USE_APICHECK=1 and this catches some
|
|
|
|
-- bugs in lgi. Thus, do not run this test with Lua 5.3 until lgi is fixed.
|
|
|
|
-- We run into the same bug when doing code-coverage analysis, supposedly
|
|
|
|
-- because the additional GC activity means that something which is GC-able when
|
2017-06-27 08:58:17 +02:00
|
|
|
-- it should not gets collected too early.
|
|
|
|
-- This test also sporadically errors on LuaJIT ("attempt to call a number
|
|
|
|
-- value"). This might be a different issue, but still, disable the test.
|
|
|
|
if _VERSION == "Lua 5.3" or debug.gethook() or jit then --luacheck: globals jit
|
2017-06-23 11:31:54 +02:00
|
|
|
print("Skipping this test since it would just fail.")
|
|
|
|
runner.run_steps { function() return true end }
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2017-06-27 08:54:03 +02:00
|
|
|
-- Make sure no error messages for non-existing directories are printed. If the
|
|
|
|
-- word "error" appears in our output, the test is considered to have failed.
|
|
|
|
do
|
|
|
|
local gdebug = require("gears.debug")
|
2017-08-24 22:53:27 +02:00
|
|
|
local orig_warning = gdebug.print_warning
|
|
|
|
function gdebug.print_warning(msg)
|
2017-06-27 08:54:03 +02:00
|
|
|
msg = tostring(msg)
|
2017-08-24 22:53:27 +02:00
|
|
|
if (not msg:match("/dev/null/.local/share/applications")) and
|
2017-06-27 08:54:03 +02:00
|
|
|
(not msg:match("No such file or directory")) then
|
2017-08-24 22:53:27 +02:00
|
|
|
orig_warning(msg)
|
2017-06-27 08:54:03 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-24 14:48:17 +02:00
|
|
|
local show_menubar_and_hide = function(count)
|
|
|
|
-- Just show the menubar and hide it.
|
|
|
|
-- TODO: Write a proper test. But for the mean time this is better than
|
|
|
|
-- nothing (and tells us when errors are thrown).
|
|
|
|
|
|
|
|
if count == 1 then
|
|
|
|
menubar.show()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Test that the async population of the menubar is done
|
|
|
|
if menubar_refreshed then
|
|
|
|
menubar.hide()
|
|
|
|
awesome.sync()
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-06-14 09:41:30 +02:00
|
|
|
runner.run_steps {
|
|
|
|
function(count)
|
2020-04-24 14:48:17 +02:00
|
|
|
-- Show and hide with defaults
|
|
|
|
return show_menubar_and_hide(count)
|
|
|
|
end,
|
2017-06-14 09:41:30 +02:00
|
|
|
|
2020-04-24 14:48:17 +02:00
|
|
|
function(count)
|
|
|
|
-- Show and hide with match_empty set to false
|
|
|
|
menubar.match_empty = false
|
|
|
|
return show_menubar_and_hide(count)
|
2017-06-14 09:41:30 +02:00
|
|
|
end,
|
|
|
|
|
|
|
|
function()
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|