diff --git a/lib/beautiful/xresources.lua b/lib/beautiful/xresources.lua index d9b174b9..333d5aa4 100644 --- a/lib/beautiful/xresources.lua +++ b/lib/beautiful/xresources.lua @@ -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 diff --git a/spec/awful/keyboardlayout_spec.lua b/spec/awful/keyboardlayout_spec.lua index 99692a91..ae168e9f 100644 --- a/spec/awful/keyboardlayout_spec.lua +++ b/spec/awful/keyboardlayout_spec.lua @@ -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() diff --git a/spec/wibox/widget/textbox_spec.lua b/spec/wibox/widget/textbox_spec.lua index 9200a6b6..10f5028a 100644 --- a/spec/wibox/widget/textbox_spec.lua +++ b/spec/wibox/widget/textbox_spec.lua @@ -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()