repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

hypr/tests/hypr_osd_test.lua

Raw
File outline
package.path = "./?.lua;./?/init.lua;" .. package.path

local osd = require("modules.hypr_osd")

local function assert_contains(haystack, needle)
  assert(haystack:find(needle, 1, true), haystack .. " does not contain " .. needle)
end

local function assert_not_contains(haystack, needle)
  assert(not haystack:find(needle, 1, true), haystack .. " contains stale " .. needle)
end

assert_contains(osd.session.reload, "qs ipc -c nuguland call nuguland osdReloadHypr")
assert_contains(osd.session.lock, "qs ipc -c nuguland call nuguland osdSessionLock")
assert_contains(osd.session.suspend, "qs ipc -c nuguland call nuguland osdSessionSuspend")
assert_contains(osd.capture.region(), "qs ipc -c nuguland call nuguland osdCaptureRegion")
assert_contains(osd.capture.annotate(), "qs ipc -c nuguland call nuguland osdCaptureAnnotate")
assert_contains(osd.capture.color, "qs ipc -c nuguland call nuguland osdPickColor")
assert_contains(osd.controls.volume_up, "qs ipc -c nuguland call nuguland osdVolumeUp")
assert_contains(osd.controls.brightness_up, "qs ipc -c nuguland call nuguland osdBrightnessUp")
assert_contains(osd.notifications.clear_all, "qs ipc -c nuguland call nuguland dismissNativeNotifications")

for _, command in pairs({
  osd.session.reload,
  osd.controls.volume_up,
  osd.controls.brightness_up,
  osd.notifications.clear_all,
}) do
  assert_not_contains(command, "hyprctl notify")
  assert_not_contains(command, "makoctl")
  assert_not_contains(command, "wpctl")
  assert_not_contains(command, "brightnessctl")
end

print("hypr_osd ok")