Make beautiful work directly under unit tests

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-02-21 17:08:50 +01:00
parent 3db87c693a
commit f3091154f6
3 changed files with 7 additions and 15 deletions

View File

@ -74,7 +74,13 @@ function xresources.get_dpi(s)
return dpi_per_screen[s]
end
if not xresources.dpi then
xresources.dpi = tonumber(awesome.xrdb_get_value("", "Xft.dpi") or 96)
-- Might not be present when run under unit tests
if awesome and awesome.xrdb_get_value then
xresources.dpi = tonumber(awesome.xrdb_get_value("", "Xft.dpi"))
end
if not xresources.dpi then
xresources.dpi = 96
end
end
return xresources.dpi
end

View File

@ -3,11 +3,6 @@
-- @copyright 2015 Uli Schlachter and Kazunobu Kuriyama
---------------------------------------------------------------------------
-- Hack so that beautiful can be loaded
_G.awesome = {
xrdb_get_value = function() end
}
local kb = require("awful.widget.keyboardlayout")
describe("awful.widget.keyboardlayout get_groups_from_group_names", function()

View File

@ -3,15 +3,6 @@
-- @copyright 2015 Uli Schlachter
---------------------------------------------------------------------------
-- Grml...
_G.awesome = {
xrdb_get_value = function(a, b)
if a ~= "" then error() end
if b ~= "Xft.dpi" then error() end
return nil
end
}
local textbox = require("wibox.widget.textbox")
describe("wibox.widget.textbox", function()