From b51a20670b8f4025fc955467f0f0139323f6d61c Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 15 Dec 2019 01:59:13 -0500 Subject: [PATCH] tests: Test client.active. --- tests/test-focus.lua | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/test-focus.lua b/tests/test-focus.lua index 5a2fe90d8..6b5191f0d 100644 --- a/tests/test-focus.lua +++ b/tests/test-focus.lua @@ -3,6 +3,7 @@ local runner = require("_runner") local awful = require("awful") +local gdebug = require("gears.debug") local beautiful = require("beautiful") beautiful.border_color_normal = "#0000ff" @@ -64,8 +65,36 @@ local steps = { test("#123456") test("#12345678") test("#123456ff", "#123456") + return true - end + end, + + function() + assert(client.focus) + local called, called2 = false, false + gdebug.print_warning = function() called = true end + local c2 = client.focus + + client.focus.active = false + assert(called) + assert(not client.focus) + assert(not c2.active) + called = false + + local real_assert = assert + assert = function() called2 = true end --luacheck: globals assert + + c2.active = true + + assert = real_assert --luacheck: globals assert + + assert(called2) + assert(not called) + assert(c2.active) + assert(client.focus == c2) + + return true + end, } runner.run_steps(steps)