Commit Graph

353 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee ab0a9a077e doc: Add a `rotate` default screenshot 2016-05-30 18:00:58 -04:00
Emmanuel Lepage Vallee e57ae1789d doc: Add a container default example template
This will be implemented by each container and then grouped into
a list by CMake and inserted in the widget system documentation.
2016-05-30 18:00:58 -04:00
Emmanuel Lepage Vallee bc2c0cfcb0 doc: Add a wibox.container.rotate example
Also fix the documentation
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee ac7ea4c70f tests: Fix coverage data
As the documentation generation insert increasingly large ammount
of code into the lua files, the coverage data is getting less and
less accurate. This try to fix this by only collecting such data
after the `configure_file` calls are done.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee ae0d306114 textclock: Move to wibox.widget
It doesn't depend on `awful`, so it doesn't belong in `awful`.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee 44a4eca40e doc: Port the shape images to the doc example system 2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee feb3833fd1 doc: Move the background examples to the container suit 2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee d85588babe wibox: Create a container module
Previously, the "containers" were placed in layout or widget.

They all have similar APIs and usage, so lets bring them together.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee 9f74416ef4 placement: Remove leftover prints 2016-05-29 23:50:37 -04:00
Uli Schlachter badf338542 Add awesome.hostname
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-27 19:22:42 +02:00
Uli Schlachter 2d35886a76 Add awesome.{kill,unix_signal}
kill is a wrapper around the POSIX kill() function and unix_signal is a table
that maps signal numbers to their names and signal names to their numeric value.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-27 19:22:41 +02:00
Emmanuel Lepage Vallée c1d3f291fe Merge pull request #913 from Elv13/gear_obj_props
Gear.object properties
2016-05-18 15:20:43 -04:00
Emmanuel Lepage Vallee bb5ee50de9 layoutbox: Revert 25f4f24791
Apparently, there is such thing as not leaking enough...

Also try to clear the widgets from mywibox. This seem to help.

Time will tell.

Fixes #914, unfixes #808
2016-05-18 01:45:21 -04:00
Emmanuel Lepage Vallee d6a7b6c645 object: Add a dynamic property example 2016-05-18 01:23:53 -04:00
Emmanuel Lepage Vallee f810d78e7b object: Add a signal example 2016-05-18 01:23:53 -04:00
Emmanuel Lepage Vallee 08df8fbf03 doc: Add a generic template for text only tests 2016-05-18 01:23:53 -04:00
Emmanuel Lepage Vallee 52208bc728 tests: Test wibox attachment, wibars and struts 2016-05-15 17:17:12 -04:00
Emmanuel Lepage Vallee b4f08eb7b6 tests: Add asserts to under_mouse 2016-05-15 17:17:12 -04:00
Emmanuel Lepage Vallee 0dcc545f35 tests: Update the miss handler test 2016-05-15 17:17:11 -04:00
Emmanuel Lepage Vallee f4b2043da5 tests: Fix the wibox template 2016-05-15 17:15:55 -04:00
Emmanuel Lepage Vallee df1cc6d008 tests: Add awful.widget.button mouse release 2016-05-10 16:06:46 -04:00
Uli Schlachter 9d30bf87ae Merge branch 'more-travis-variance' of https://github.com/psychon/awesome 2016-05-09 18:42:09 +02:00
Uli Schlachter 1ab3f43575 Merge branch 'useful-env-vars' of https://github.com/psychon/awesome 2016-05-09 18:41:02 +02:00
Uli Schlachter c62da0dcc7 Merge branch 'fake-screen2' of https://github.com/psychon/awesome 2016-05-09 18:40:50 +02:00
Daniel Hahler 58209cd89e Use an uneven screen width/height (1921x1079) in one Travis job (#870)
This is meant to trigger issues that would need `math.ceil()` fixes etc.

Ref: https://github.com/awesomeWM/awesome/issues/848#issuecomment-216068831
2016-05-08 20:58:19 +02:00
The Personal Things df5ecd4c6f tests: test-resize: use math.ceil to handle uneven screen width (#882)
See https://github.com/awesomeWM/awesome/issues/848#issuecomment-217361136.

This is actually a leftover from 612756f and is meant to fix the failure
at https://github.com/awesomeWM/awesome/pull/870.
2016-05-08 19:00:59 +02:00
Uli Schlachter 7ea816045d "make check": Support out-of-tree builds
Currently, tests/run.sh expects the directory layout that our wrapper Makefile
sets up before running CMake. This commit adds support for any other directory
configuration as well.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 18:52:18 +02:00
Uli Schlachter beb9b7f950 tests/run.sh: Set up some useful env vars
GDK_SCALE=1 is needed to overwrite other settings that people might have which
would make geometry-related tests fail.

NO_AT_BRIDGE=1 gets rid of the following message that I am seeing:

** (lua:8321): WARNING **: Error retrieving accessibility bus address:
org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not
provided by any .service files

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 16:48:24 +02:00
Uli Schlachter 014f68a84d Add a functional test for addition and removal of screens
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 15:01:06 +02:00
Uli Schlachter 975aac5c0c awful.tag: Delete a screen's tag on removal
Any clients with these tags end up somewhere random (the first tag on the first
remaining screen). This certainly can be improved in the future, but at least
this is a start.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:52:31 +02:00
Uli Schlachter e4c3554c22 tests/_client.lua: Don't use GtkApplication
GtkApplication does magic like ensuring that the application ID is unique and
there is only a single instance of each application running. We don't want nor
need that for the tests.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:52:31 +02:00
Uli Schlachter bcc7c65f77 tests/_client.lua: Allow class to be unspecified
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:52:31 +02:00
Uli Schlachter 2da6ec0912 tests/_client.lua: Add missing modelines
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:51:33 +02:00
Emmanuel Lepage Vallée d497cdf081 Merge pull request #875 from psychon/sn-fix
Startup-Notification fix
2016-05-08 01:03:16 -04:00
Emmanuel Lepage Vallée 504018343b Merge pull request #873 from Elv13/geometry_overhaul_p3.01
Geometry overhaul p3.01
2016-05-05 16:23:11 -04:00
Uli Schlachter 6b4a2625cb test-spawn-snid.lua: Use test client instead of urxvt
Startup notification support in urxvt is optional while GTK always supports
startup notification. Thus, use the new GTK-based test client for the SN tests.

Fixes: https://github.com/awesomeWM/awesome/issues/848
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-05 18:48:24 +02:00
Emmanuel Lepage Vallee 66ca66ca87 tests: Add basic drawin shim 2016-05-03 17:12:54 -04:00
Daniel Hahler 087d578755 tests: fail if $AWESOME does not exist / is not executable (#872)
Without this the stdout/stderr rediraction when launching it makes the
error regarding the "program not found" disappear(?!).

[ci skip]
2016-05-03 12:08:00 +02:00
Jajauma 612756ff0e tests: test-resize: use math.ceil to handle uneven screen height
See https://github.com/awesomeWM/awesome/issues/848#issuecomment-216052517.
Closes https://github.com/awesomeWM/awesome/pull/869.
2016-05-02 01:43:11 +02:00
Emmanuel Lepage Vallée dbd0931343 Merge pull request #844 from Elv13/geometry_overhaul_p2
Geometry overhaul part 2.5
2016-04-30 23:29:29 -04:00
Emmanuel Lepage Vallee e41853a47a tests: Test floating client move, snap and resize 2016-04-30 04:27:34 -04:00
Emmanuel Lepage Vallee fc2d359722 doc: Add a coords example
This forced the `coords()` documentation to be moved to Lua.
Keeping it in the C file caused yet another example CMake hack.
2016-04-30 04:27:34 -04:00
Emmanuel Lepage Vallee e8dd707508 tests: The the mouse miss handler 2016-04-30 04:27:34 -04:00
Emmanuel Lepage Vallee f0546b900d tests: Improve the placement compositing tests 2016-04-30 04:27:34 -04:00
Emmanuel Lepage Vallee bb0a2addb4 tests: Add an option to disable @usage ldoc tag 2016-04-30 04:27:34 -04:00
Emmanuel Lepage Vallee 75764108e1 awful.placement: Make all functions return the geometry 2016-04-30 04:27:33 -04:00
Emmanuel Lepage Vallee 3e7a7f23c2 tests: Test awful.placement.resize_to_mouse 2016-04-30 04:27:33 -04:00
Emmanuel Lepage Vallee a072e34194 shims: Add the request:: signals 2016-04-30 03:34:14 -04:00
Uli Schlachter c6fafe06c0 Default config: Remove tags table
Tags are accessible as s.tags on a screen object. Yup, that's harder to find
than a variable that is defined in the default config, but such is life.

Now that awful.rules supports specifying tags by name, I guess that the number
one reason for needing the tags table is gone.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-26 09:36:53 +02:00
Emmanuel Lepage Vallee d736850e60 tests: Fix urgent test use of deprecated functions
It caused noise in the test results
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f2a19690ac tests: Test geometry changes 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 8875b66d2e tests: Test awful.rules 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 9798b455cb tests: Add a flexible dummy client.
XTerm isn't really a perfect test candidate.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f5a27ab99b tests: Test maximizing and fullscreen 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 299e155acc client: Extend request::tag instead of awful.tag.withcurrent
There was a regression when refactoring the API. It was no longer
possible to disable the automatic tag selection.

Due to recent changes, it was no longer possible to disable the
default tag selection handler. This commit extend the already
existing request::tag mechanism to let handlers select the tags.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee fe8beaeaac placement: Fix incorect use of the border_width
The code and tests assumed the border was equaly applied around
the geometry while the {x,y} pair of the geometry include the
border.
2016-04-18 23:56:23 -04:00
Emmanuel Lepage Vallee 798729ff11 tests: Test placement composition 2016-04-18 23:55:52 -04:00
Emmanuel Lepage Vallee bb47aa5861 tests: Test all client layouts 2016-04-18 04:20:23 -04:00
Uli Schlachter 9efc5ca409 test-urgent.lua: Test "tag by name" rules
With this commit, the code added previously to awful.rules is now also tested.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:31:46 +02:00
Emmanuel Lepage Vallee f9add1c49a awful.tag: Rename nmaster to master_count 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee e8908e2c62 awful.tag: Rename mwfact to master_width_factor 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 194720c821 tests: Test awesomerc keybindings 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 5e7b1bf507 tests: Test awful.tag against regressions 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee c7fb00dd47 tests: Test awful.screen against regressions 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee f8fc0e27bf tests: Test awful.client against regressions
This make sure the property system did not introduce infinite
dependency loops.
2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee dd52f1ce86 awful.tag: Move functions to awful.client and screen 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 00d782f3d3 awful.screen: Deprecate functions, add methods 2016-04-11 23:54:28 -04:00
Daniel Hahler b6810576b0 tests/run.sh: display number of errors [ci skip] 2016-04-06 01:54:18 +02:00
Emmanuel Lepage Vallee 4819be4f4f build: Do not exit when gears.debug.print_warning are issued 2016-04-03 23:45:56 -04:00
Emmanuel Lepage Vallée c93ac5243f Merge pull request #785 from Elv13/geometry_overhaul_p1
Geometry overhaul part 1
2016-04-02 22:06:23 -04:00
Emmanuel Lepage Vallee 421c10b19a Change autogenerated images name
Github drop files when the leading character is ., ~, # or _

This commit add a prefix in front of the name to avoid leading
underscores.
2016-03-31 23:42:05 -04:00
Emmanuel Lepage Vallee ef5ec333cc tests: Test the remaining existing `awful.placement` methods.
Notes that some asserts are missing because the tests fail. This
will be fixed later. It is not a regression.
2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee 4bc3f04ec1 tests: Test `awful.placement.maximize` aliases 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee 7ab83afbbc tests: Test `awful.placement.maximize` 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee 7b7d09edff tests: Test all `awful.placement.stretch` aliases 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee 7b7802f559 tests: Test `awful.placement.stretch` 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee dd0ea33015 tests: Test the new `awful.placement` aliases 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee db2f545411 tests: Test `awful.wibox.align` 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee 61d143fe98 tests: Test `awful.placement.closest_corner`
The output image look fine, some `assert()` could be added.
2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee ea40fbd198 shims: Add property::workarea 2016-03-31 05:04:24 -04:00
Emmanuel Lepage Vallee c62116f505 tests: Add wibox.widget.background tests 2016-03-31 04:45:46 -04:00
Emmanuel Lepage Vallee 25c76322a0 tests: Add a template to take screenshots of widgets 2016-03-31 04:45:45 -04:00
Emmanuel Lepage Vallee 9f1565c798 tests: Add a template to test clients, screens, tags and mouse 2016-03-31 04:45:45 -04:00
Emmanuel Lepage Vallee c9f8690a60 tests: Add some shims to emulate CAPI without an X server 2016-03-31 04:45:45 -04:00
Emmanuel Lepage Vallee e7652a053d tests: Add a new testing framework 2016-03-31 04:45:45 -04:00
Emmanuel Lepage Vallee 18ef42abfc tests: Update the miss handler test 2016-03-30 23:25:44 -04:00
Emmanuel Lepage Vallée e8c7e573cb Merge pull request #778 from Elv13/dummy2
Call collectgarbage() more often

This may or may not fix a random test failure on Travis with LuaJIT (5.1).
2016-03-27 17:05:02 -04:00
Uli Schlachter 5ccdb933bf C-API: Return screen objects instead of indicies
This commit makes all C code that previously returned a screen index now return
a screen object, continuing the deprecation of screen indicies. Note that this
is an API break and will likely cause all kinds of problems for users.

The change also breaks some tests which are suitably fixed in this commit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-26 18:09:24 +01:00
Emmanuel Lepage Vallee 182f21b48a tests: Call collectgarbage 3 time
Try to avoid a race condition when testing awful.layout
2016-03-26 05:14:59 -04:00
Uli Schlachter 02cdb5103b Run shape-example-generation under LuaCov
This is ugly, but at least it works. Hopefully...

Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
2016-03-17 10:22:42 +01:00
Emmanuel Lepage Vallee b6871833c4 cmake: Generate gears.shape SVG and example code 2016-03-16 18:02:41 -04:00
Emmanuel Lepage Vallee ac15475c58 gears.shape: Add unit tests / examples / SVG generator 2016-03-16 18:02:41 -04:00
Daniel Hahler 9f5e6c3827 Merge pull request #743 from psychon/keygrabber-errors
Keygrabber errors
2016-03-07 00:25:35 +01:00
Daniel Hahler cc5415b389 Merge pull request #736 from blueyed/fix-integration-tests-runner
tests/run.sh: avoid warnings by setting up fg/bg/colors in xrdb
2016-03-06 15:13:16 +01:00
Uli Schlachter 93e50b2e23 Merge branch 'lua-index-handlers' of https://github.com/psychon/awesome 2016-03-06 14:19:00 +01:00
Uli Schlachter e18bece3df Make tests more reliable on "early errors"
When e.g. test-leaks.lua fails, it will cause a Lua error before starting the
test runner. This means that the test will just hang, because nothing causes
awesome to quit.

Handle this by starting a timer when the test runner is loaded and quitting
awesome in there if no test run was started yet. This only works if all tests
load the runner before doing anything that could fail, so the require("_runner")
is moved to the beginning in every test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-06 10:20:45 +01:00
Daniel Hahler 3730086bcc tests/run.sh: avoid warnings by setting up fg/bg/colors in xrdb 2016-03-04 01:41:43 +01:00
actionless 504c105cba feat(awful: widgets): add 'watch' widget 2016-02-28 12:11:57 +01:00
Daniel Hahler bbab321314 Merge pull request #702 from psychon/fix-test-urgent
Fix test-urgent.lua
2016-02-16 01:03:37 +01:00
Daniel Hahler 9257c96b7c Merge pull request #690 from psychon/make-test-runner-more-robust
Make the functional test runner more robust
2016-02-16 01:03:06 +01:00
Uli Schlachter e5d3b2a25c Fix test-urgent.lua
Step 1 starts a client and uses awful.rules to move it to a not-selected tag.
Because this rule still has focus=true, this calls awful.ewmh.activate() via the
request::activate signal. This function makes the client urgent because it is on
a not-selected tag.

Step 3 does the same thing, but also uses switchtotag=true. Now
awful.ewmh.activate() doesn't make the client urgent because it successfully
focused this client. However, the test was wrongly assuming that the client
became urgent (copy&paste error? I don't know).

The fix is of course not to require the client to become urgent.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-15 22:09:10 +01:00
Uli Schlachter 99ef5822b0 Merge branch 'more-luacheck-fixes' of https://github.com/psychon/awesome 2016-02-14 14:33:06 +01:00
Uli Schlachter f87da55dfc Make the functional test runner more robust
Currently, an error in the default config in the right place isn't noticed. Fix
this by doing two things:

- Also grep for "error" (this catches runtime errors with a stack trace)
- Make _runner print a "success" message at the end and also grep for that

Fixes: https://github.com/awesomeWM/awesome/issues/689
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-13 07:36:59 +01:00
Uli Schlachter 432908dd26 Fix test-leak-client.lua under LuaCov
Both the test runner and the wibox use gears.timer.delayed_call(). The test
runner uses this to call steps and the wibox uses it to trigger redraws. When
running under LuaCov, the Lua code becomes slow enough that the wibox didn't
redraw yet when the leak check is run. This causes the check to fail, because
the client is still referenced by the tasklist and thus cannot be garbage
collected.

Fix this by waiting one more iteration before running the leak check.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:26:29 +01:00
Uli Schlachter bf3b9b5f42 tests: Fix luacheck warnings
This leaves one warning in tests/test-urgent.lua which points out an actual
bug/problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:12:41 +01:00
Daniel Hahler 33b2277df9 Merge pull request #649 from psychon/make-benchmark-less-exact
Make benchmarks less exact
2016-02-11 21:26:32 +01:00
Uli Schlachter e2d75dbcfd Add a functional testing for leaks with clients
This opens xterm, closes it and makes sure that the client object representing
xterm is GC'able at the end. The test will fail currently.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-04 18:24:53 +01:00
Uli Schlachter 6d6cf20790 Make benchmarks less exact
The benchmarks in tests/test-benchmark.lua have two modes. When CI=1 is set in
the environment, only a "quick" and less exact test is done. Otherwise, a slower
and more exact measurements is taken. This was added so that we do not waste CPU
time on travis.

However, most of the time the user running "make check" doesn't want exact
measurements either. So instead of only being quick when CI=1 is set, this
commit changes the logic to always being quick unless BENCHMARK_EXACT=1 is set.
Additionally, a message is printed next to the benchmark results so that the
user is reminded to set this var if the measurements should actually mean
something.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-23 16:08:33 +01:00
Uli Schlachter 781f8d30bb test/run.sh: Handle updated beauitful.init call in default config
While setting up an environment to run the integration tests in, the run.sh
script uses sed to generate versions of several files that refer to the
not-installed version of files. One of these needs to replace the call to
beautiful.init().

Before commit 20c9723c5b, the corresponding line was:

  beautiful.init("@AWESOME_THEMES_PATH@/default/theme.lua")

Now this wants to find and replace the following:

  beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua")

To handle both versions, this commit adds some wildcards to the sed-expression
so that any line containing a call to beautiful.init is found and replaced.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 16:16:39 +01:00
Daniel Hahler 833b10eb9b Merge pull request #593 from psychon/editorconfig
Vim modelines and editorconfig
2015-12-12 19:13:53 +01:00
Uli Schlachter 63653bed76 Add the right vim modeline to all lua files
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:42:33 +01:00
Uli Schlachter 5db6c04c42 Add vim modelines to all shell scripts
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:36:35 +01:00
Uli Schlachter 469433e10a awful.spawn.with_line_callback: Use an arguments table
Having many arguments can easily get confusing and hard to understand. This
commit uses a table instead so that we have names that identify what each
callback does.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:27:33 +01:00
Uli Schlachter 2f5ade49c2 test-spawn.lua: Also test exit statuses
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-29 11:57:35 +01:00
Daniel Hahler 339e2b0ecc Add failing test: c.startup_id should be nil when snid is disabled
When using `spawn` without startup notification support, the
`startup_id` property on the client should be nil.

This adds rxvt-unicode to the Travis build, because it supports startup
notifications, but xterm does not.  We should replace xterm with it in
the existing tests then later.
2015-11-05 23:03:59 +01:00
Uli Schlachter e3199edca1 Merge branch 'snid_callback' of https://github.com/Elv13/awesome-1 2015-10-10 19:52:41 +02:00
Daniel Hahler fa1dea6df4 Improve test runner to be usable for git-bisect 2015-10-03 14:54:17 +02:00
Emmanuel Lepage Vallee 4095eb91a8 Move util.spawn to a new module, add ability to spawn with properties
* This commit add a new module to avoid a (4 level) loop dependency
* It is now possible to call awful.spawn() with a table of properties
* awful.rules is used to execute the rules.

* Everything is public to allow alternative workflow modules such as
    Tyrannical to use their own callback implementation.
2015-09-29 18:05:56 -04:00
Uli Schlachter a5a106f97f Make it possible for Lua to emulate arbitrary properties
This makes it possible to add something similar to a __index / __newindex
metamethod to all our C objects. Based on this, Lua can then easily implement
arbitrary properties on our capi objects.
2015-09-27 17:43:41 +02:00
Uli Schlachter 3e9fdea650 test-leaks: Fix with Lua 5.1
I have no idea why this needs collectgarbage() to be called twice.

On the other hand, I can explain the change in tooltip.lua. Lua 5.2 introduced
"ephermeron tables". This means that in the following sitation, lua 5.2 can
collect the entry from the table, while 5.1 keeps the entry alive, because the
table has a strong reference to the value and that in turn has a strong
reference to the key:

  t = setmetatable({}, { __mode = "k"})
  do
    local k = {}
    t[k] = function() print(k) end
  end
  collectgarbage("collect")
  print(next(t, nil))

To handle this incompatibility, this commit just removes the whole indirection
through the module-level variable "data".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 16:04:20 +02:00
Uli Schlachter 94271e8c91 test-leaks.lua: Also test tooltips
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:31:42 +02:00
Uli Schlachter f7799cbb7f Refactior test-leaks a bit
I think it looks nicer with this helper function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:30:04 +02:00
Uli Schlachter cd1ad8b753 Don't measure time for creating wiboxes
Apparently some of the last commits speeds up create_wibox() a lot. This
highlights that this is a bad test: After creating thousands of wiboxes, awesome
needed 15 seconds to draw all of them and in the end some dbus timeout aborted
the test run.

However, it's irrelevant how quickly we can create wibox. The interesting number
is how quickly we can display a new wibox. Thus, this commits changes the code
so that it also measures the time that is needed to update the wibox. This way,
we don't accumulate a huge number of pending repaints and everything's fine.

Some results (but there is nothing to compare this with):
   create&draw wibox: 0.0373947  sec/iter ( 28 iters, 1.59 sec for benchmark)
    update textclock: 0.00198174 sec/iter (515 iters, 1.937 sec for benchmark)
  relayout textclock: 0.000614439 sec/iter (1710 iters, 1.051 sec for benchmark)
    redraw textclock: 0.00116882 sec/iter (865 iters, 2.962 sec for benchmark)
          tag switch: 0.000705579 sec/iter (1498 iters, 3.703 sec for benchmark)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:07:22 +02:00
Uli Schlachter dc2147208f tests: Return more widgets from create_wibox()
All of these are checked for being GC'able in test-leaks.lua.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:44:19 +02:00
Uli Schlachter bd47edb4ef leak test: Make the layoutbox test pass
This commit does two things: It gets rid of the reference to the layoutbox that
the default config created and it changes the widget dependency cache to not
keep widgets alive unnecessarily.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:42:39 +02:00
Uli Schlachter abc5a552a4 Make tasklist garbage-collectable
Again, instead of directly connecting to various signals for updating a
tasklist, this commit changes the code so that there is just a single, global
connections and based on this a weak table with all tasklist instances is used
do the updates.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:20:24 +02:00
Uli Schlachter 40db0b7337 Make taglists garbage-collectable
Similar to what the previous commit does for layoutboxes, this changes the code
for the taglist so that there is only a single, global connection to the various
signals and these update all taglists via weak tables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:03:59 +02:00
Uli Schlachter 901c8f680a tests: Add some memory-leak tests
This creates some random collection of widgets and tests if they can be garbage
collected again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 12:36:21 +02:00
Uli Schlachter 225022be84 tests: Move create_wibox() into a helper script
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 11:58:35 +02:00
actionless 3fea174c5e test(benchmark): add for tag switch
Closes https://github.com/awesomeWM/awesome/pull/465.
2015-09-23 21:02:29 +02:00
Uli Schlachter 8abce1ff68 Add a benchmark to the test suite
This (ab)uses the integration tests to run a benchmark. This currently only
measures wibox drawing performance. To avoid wasting CPU-cycles, this does only
a quick run under travis while on "normal" runs the function under test is
executed in a loop to improve the precision of the measurement.

This benchmarks hopefully allow to optimize things in a clear fashion instead of
things like "it feels faster to me".

Results when run against the previous commit:

== Running test-benchmark.lua ==
        create wibox: 0.0788958  sec/iter ( 13 iters, 1.103 sec for benchmark)
    update textclock: 0.019493   sec/iter ( 56 iters, 2.507 sec for benchmark)
  relayout textclock: 0.0160725  sec/iter ( 63 iters, 1.029 sec for benchmark)
    redraw textclock: 0.0015601  sec/iter (647 iters, 1.875 sec for benchmark)
W: awesome: a_glib_poll:291: Last main loop iteration took 6.593912 seconds! Increasing limit for this warning to that value.

Results right before the new widget layouts were merged (commit 52154d0f15):

== Running test-benchmark.lua ==
        create wibox: 0.0782874  sec/iter ( 13 iters, 1.095 sec for benchmark)
    update textclock: 0.00736755 sec/iter (136 iters, 1.346 sec for benchmark)
W: awesome: luaA_dofunction:77: error while running function
[...]
error: /home/psychon/projects/awesome/build/lib/gears/object.lua:30: Trying to emit non-existent signal 'widget::layout_changed'

Closes https://github.com/awesomeWM/awesome/pull/451.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-19 12:02:44 +02:00
Daniel Hahler 7c8e97ca31 Merge pull request #406 from psychon/spawn_with_pipes2
Spawn with pipes

Closes https://github.com/awesomeWM/awesome/pull/406.
2015-09-02 22:47:09 +02:00
Uli Schlachter 3c4a80ca7e Add a test for awful.util.spawn_with_line_callback
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-02 22:27:47 +02:00
Uli Schlachter 1beda989e5 tests/_runner.lua: Load all dependencies
This tried to use awful, but didn't load awful itself. Kids, this is why you
should make your variables local!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-02 21:51:20 +02:00
Uli Schlachter 4bfddbb3f8 tests/run.sh: Start Xvfb with -noreset
When using Xephyr, this already starts the server with -noreset, but for Xvfb we
also need this flag. Without this flag, the DPI value that is set via xrdb gets
lost at server reset.

This wasn't a problem before commit 6d4837a53a. That commit moved the launch
of the dbus session after the setting of the DPI. So previously, waiting for
server startup was half broken (the dbus session already tried to connect to the
server to check for when it shuts down), but due to this no server reset
occurred and thus the DPI was correctly applied. After this commit, the server
immediately resets after xrdb is done setting the DPI and the value set is lost.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-13 12:59:57 +02:00
Uli Schlachter cbba615748 tests/run.sh: Show full error messages
If an error occurs during startup, tail might not show the full error message.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:49:30 +02:00
Uli Schlachter 0ee24317c7 tests/run.sh: Temporarily disable -x in wait_until_success
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:49:30 +02:00
Uli Schlachter 17e8827212 tests/run.sh: Factor out a helper function
This factors out a function wait_until_success that runs some command until it
succeeds (with a timeout) and uses this function in the two places where this
was already done before.

Note that this removes the "kill -0" trick for early exit again and instead will
use the timeout in case awesome dies during startup.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:49:28 +02:00
Uli Schlachter 0688e8899e tests/run.sh: Allow execution without installing
When this script is not run under Travis, it will prepare a temporary config
file and a theme file that point to the files that were not yet installed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:49:08 +02:00
Uli Schlachter d8a1b563e7 tests/run.sh: Use a temporary directory
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:48:28 +02:00
Uli Schlachter 41d81a4501 tests/run.sh: Move definition of AWESOME_CLIENT up
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:48:27 +02:00
Uli Schlachter 6d4837a53a tests/run.sh: Start dbus after X server startup
The code does some dances with xrdb to ensure that the server finished starting
up. However, before this it already tries to access the server via dbus-launch.

Since nothing uses dbus in this part of the code, we can just move this down.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:48:27 +02:00
Daniel Hahler 85facc0391 tests/run: handle 'expr 1 - 1' (exitcode 1); check for running awesome 2015-08-11 19:08:35 +02:00
Daniel Hahler 2b224dd954 tests: use root.fake_input instead of xdotool
Ref: https://github.com/awesomeWM/awesome/issues/328.
Closes: https://github.com/awesomeWM/awesome/pull/391.
2015-08-10 23:04:19 +02:00
Daniel Hahler 22624284a2 tests/_runner.lua: use xpcall+traceback with step error handler 2015-07-22 13:52:47 +02:00
Daniel Hahler f070c4e060 tests: wait until DISPLAY is ready; xrdb might complain/abort 2015-07-21 13:09:07 +02:00
Daniel Hahler 2c3c6b5ca8 tests: cleanup, remove sleep/print 2015-07-18 15:08:27 +02:00
Uli Schlachter f4ed41b39a tests: Check if test file is readable before running it
I tried calling this script with "tests/foo.lua" as an argument, but it actually
expects "foo.lua" since it changes into the appropriate directory itself.
Because this file does not exist, "cat $f | awesome-client" failed and thus this
whole script just hung (the test runner was never actually started).

Fix this by testing for the test-file to exist before trying to run it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-07-18 12:35:57 +02:00
Uli Schlachter f2a079204d tests: Make dbus session automatically exit when X server dies
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-07-18 10:45:03 +02:00
Uli Schlachter 534084698b tests/run.sh: Use $! instead of pgrep
And yes, $! is specified by POSIX and thus should be portable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-07-18 10:44:16 +02:00
Daniel Hahler 430fe7f710 tests/run.sh: fix 'waiting for awesome' via pgrep 2015-07-16 17:05:46 +02:00
Daniel Hahler 1e9da0947e Improve tests/run.sh
- `set -x` only for Travis/CI=true.
 - improve waiting for PID and awesome-client success.
 - kill childs via trap always.

Closes https://github.com/awesomeWM/awesome/pull/316.
2015-07-15 01:30:06 +02:00
Daniel Hahler 611438a892 Add functional tests via Xephyr/Xvfb/xdotool
Closes https://github.com/awesomeWM/awesome/pull/133
2015-07-10 15:19:51 +02:00