tests: Add a flexible dummy client.

XTerm isn't really a perfect test candidate.
This commit is contained in:
Emmanuel Lepage Vallee 2016-04-12 23:18:09 -04:00
parent 6bc99fe52f
commit 9798b455cb

32
tests/_client.lua Normal file
View file

@ -0,0 +1,32 @@
local spawn = require("awful.spawn")
-- This file provide a simple, yet flexible, test client.
-- It is used to test the `awful.rules`
return function(class, title)
title = title or 'Awesome test client'
local cmd = {"lua" , "-e", table.concat {
"local lgi = require 'lgi';",
"local Gtk = lgi.require('Gtk');",
"Gtk.init();",
"local class = '",
class or 'test_app',"';",
"local window = Gtk.Window {",
" default_width = 100,",
" default_height = 100,",
" title = '",title,
"'};",
"window:set_wmclass(class, class);",
"local app = Gtk.Application {",
" application_id = 'org.awesomewm.tests.",class,
"'};",
"function app:on_activate()",
" window.application = self;",
" window:show_all();",
"end;",
"app:run {''}"
}}
spawn(cmd)
end