From fa7f1d689ecc9343629b22fc92225d32d6c0d62c Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 24 Jun 2019 23:23:12 -0400 Subject: [PATCH] tests: Change only_on_screen to create fake screens "in sight". Previously, it would create screens outside of a visible output area. In the following commit, this will be tracked and a warning is printed when it happens. This makes the test fail. --- tests/test-awful-widget-only_on_screen.lua | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/test-awful-widget-only_on_screen.lua b/tests/test-awful-widget-only_on_screen.lua index 3c0cf8b61..ffea01617 100644 --- a/tests/test-awful-widget-only_on_screen.lua +++ b/tests/test-awful-widget-only_on_screen.lua @@ -4,8 +4,22 @@ local runner = require("_runner") local wibox = require("wibox") local awful = require("awful") --- Make sure we have at least two screens to test this on -screen.fake_add(-100, -100, 50, 50) +-- Make sure we have at least two screens to test this on. +local origin_width = screen[1].geometry.width +screen[1]:fake_resize( + screen[1].geometry.x, + screen[1].geometry.y, + origin_width/2, + screen[1].geometry.height +) + +screen.fake_add( + screen[1].geometry.x+origin_width/2, + screen[1].geometry.y, + origin_width/2, + screen[1].geometry.height +) + assert(screen.count() == 2) -- Each screen gets a wibox displaying our only_on_screen widget @@ -116,7 +130,12 @@ table.insert(steps, function() for s in screen do assert(not widget_visible_on(s)) end - screen.fake_add(-100, -100, 50, 50) + screen.fake_add( + screen[1].geometry.x+origin_width/2, + screen[1].geometry.y, + origin_width/2, + screen[1].geometry.height + ) return true end) table.insert(steps, function()