mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
6aee6c2053
- Execute the tests without compiling, and don't mess with the source files when coverage is enabled. This ensures that the coverage report lines are correct. This disables the doc tests, as their results would be unused. Hack: it still expands macros on util.lua, because of `util.get_themes_dir()` and `util.get_awesome_icon_dir()`, which might be moved later. Ref: https://github.com/awesomeWM/awesome/pull/1239#discussion_r93828178. - ensure that BUILD_APIDOC and DO_COVERAGE are not used together - awesomeConfig.cmake: add DO_COVERAGE as an option - Travis: only install codecov with DO_COVERAGE=codecov - Travis: do not use set -v; use set -x with DO_COVERAGE - do not use trailing slashes with dirs in tests/examples/CMakeLists.txt / .luacov - Use latest luacov (0.12.0-1) again This reverts parts of4cc6a815
. I think it is better to fix any failure that4cc6a815
tried to work around. - Travis: simplify/fix require('luacov') for functionaltests - tests/examples/CMakeLists.txt: resolve ../.. in SOURCE_DIR - tests/examples/CMakeLists.txt: add DO_COVERAGE to env - Cleanup/simplify .luacov: work with SOURCE_DIRECTORY alone - tests/run.sh: pass through / set SOURCE_DIRECTORY when running awesome - tests/run.sh: resolve source_dir - use DO_COVERAGE from env only
63 lines
2 KiB
Lua
63 lines
2 KiB
Lua
---------------------------------------------------------------------------
|
|
-- @author Kazunobu Kuriyama
|
|
-- @copyright 2015 Kazunobu Kuriyama
|
|
---------------------------------------------------------------------------
|
|
|
|
local os = os
|
|
local string = string
|
|
local icon_theme = require("menubar.icon_theme")
|
|
|
|
local base_directories = {
|
|
(os.getenv("SOURCE_DIRECTORY") or '.') .. "/spec/menubar/icons",
|
|
(os.getenv("SOURCE_DIRECTORY") or '.') .. "/icons"
|
|
}
|
|
|
|
describe("menubar.icon_theme find_icon_path", function()
|
|
local obj
|
|
before_each(function()
|
|
obj = icon_theme("awesome", base_directories)
|
|
end)
|
|
|
|
-- Invalid arguments for `icon_name`
|
|
it("nil", function()
|
|
assert.is_nil(obj:find_icon_path(nil))
|
|
end)
|
|
it ('""', function()
|
|
assert.is.equal(obj:find_icon_path(""), nil)
|
|
end)
|
|
|
|
-- hierarchical folder (icon theme) cases
|
|
for _, v in ipairs({16, 32, 48, 64}) do
|
|
it(v, function()
|
|
local expected = string.format("%s/awesome/%dx%d/apps/awesome.png",
|
|
base_directories[1], v, v)
|
|
assert.is.same(expected, obj:find_icon_path("awesome", v))
|
|
end)
|
|
end
|
|
|
|
-- hierarchical folder (icon theme) cases w/ fallback
|
|
for _, v in ipairs({16, 32, 48, 64}) do
|
|
it(v, function()
|
|
local expected = string.format("%s/fallback.png",
|
|
base_directories[1])
|
|
assert.is.same(expected, obj:find_icon_path("fallback", v))
|
|
end)
|
|
end
|
|
|
|
-- flat folder/fallback cases
|
|
local fallback_cases = {
|
|
"awesome16",
|
|
"awesome32",
|
|
"awesome48",
|
|
"awesome64"
|
|
}
|
|
for _, v in ipairs(fallback_cases) do
|
|
it(v, function()
|
|
local expected = string.format("%s/%s.png",
|
|
base_directories[2], v)
|
|
assert.is.same(expected, obj:find_icon_path(v))
|
|
end)
|
|
end
|
|
end)
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|