Commit Graph

454 Commits

Author SHA1 Message Date
Uli Schlachter b3635a0101 Make the output of the gears.object.signal example stable (#1703)
Previously it would print a table which would include the memory
location where the table was stored. Thus, this produces a different
result on every build.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-08 10:00:34 +02:00
Kevin Zander 74fb39afbd Remove deprecated calls in tests
Change deprecated util.table call in lib/awful/widget/clienticon.lua to gears.table call
2017-03-30 23:07:20 -05:00
Kevin Zander 6cb2e0fa82 Fix some deprecated calls in code and docs
Add missing newline in test runner
2017-03-30 21:26:50 -05:00
Emmanuel Lepage Vallée b81b2149f6 Merge pull request #1679 from psychon/keyboard-layout-changes
Asynchronously update the keyboard state
2017-03-29 13:59:34 -04:00
Uli Schlachter 2f652a1de9 Speed up tests/run.sh on Travis (#1682)
tests/run.sh waits for awesome to exit via tail's "--pid" option. This
makes tail check once per second if the process still exists and if not,
tail will exit. However, the default of "once per second" causes lots of
wasted time for us.

This commit adds the argument "-s 0.1" to tail which makes tail check
once every 0.1 seconds. This commit changes the time that "tests/run.sh"
runs on Travis from about 60 seconds to about 35 seconds, which is a big
improvement.

Closes: https://github.com/awesomeWM/awesome/issues/1374
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-29 18:46:47 +02:00
Uli Schlachter 9f3a6757e9 Asynchronously update the keyboard state
When the keyboard layout is modified via xmodmap, each single "change"
(line of input to xmodmap) causes an "the keyboard configuration
changed"-event to be sent. Awesome reacted to each of these events by
reloading the keyboard layout. Thus, awesome reloaded the keyboard
layout a lot and appeared to freeze.

Fix this by asynchronously update the keyboard state: When such an event
comes in, instead of reloading things immediately, we set a flag which
makes us update the state at the end of the main loop iteration. This
means that many events still cause only a single (or at least few)
re-quering of the layout. Thus, a lot of time is saved.

This commit removes the argument to the (undocumented!) signal
xkb::group_changed. Previously, the argument was the active group
number. Since this argument was unused and I'm lazy, I just removed it.
The alternative would be that it might be visible to Lua that some "the
active group changed"-events are dropped.

Fixes: https://github.com/awesomeWM/awesome/issues/1494
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-28 15:21:01 +02:00
Kevin Zander 45dadde0dd Move filesystem functions out of awful.util into new gears.filesystem
Update awful.util filesystem function calls to gears.filesystem function calls
Rename getdir to get_dir for consistency
2017-03-15 13:46:33 -05:00
Kevin Zander c3461b535c gears: Move awful.util.table to gears.table (#1641)
* Move table functions out of awful.util into new gears.table

* travis: Use v9999 prefix for full requests

Make sure no newly deprecated functions are used

* Move all `awful.util.table.*` calls to `gears.table.*` calls
Move table test functions from awful/util_spec to new gears/table_spec
Change awful.util.subsets call to gears.math.subsets in awful/key.lua
2017-03-08 15:18:33 -05:00
Emmanuel Lepage Vallée 8f6e80f5c6 Merge pull request #1640 from psychon/add_to_wibox_lists
Add some non-helpful examples
2017-03-07 18:45:29 -05:00
Uli Schlachter 93b53bcf3f Add some non-helpful examples
This makes the scroll and only_on_screen widgets appear in the widget
lists. The examples are not really helpful, but Elv13 told me to add
them. Also, only_on_screen is in awful.widget, but now something in
tests/examples/wibox/container refers to it...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-07 11:32:17 +01:00
Uli Schlachter 6f803cf3b3 Fix code using awful.util.round
This gets rid of lots of deprecation warnings

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-06 17:11:05 +01:00
getzze bf2d658380 Add tests for grid layout
Update tests

Update tests

Separate spacing and padding tests

Update tests amd add imperative usage

Change fixed_size to homogeneous property

Update tests
2017-03-04 20:57:33 -05:00
Emmanuel Lepage Vallée 971adec0d0 Merge pull request #1622 from Veratil/fix-new-luacheck
Fix Luacheck 0.19.0 release Travis breaks
2017-03-04 13:32:53 -05:00
Daniel Hahler 0bd29ae1e9 Merge pull request #1580 from psychon/only_on_screen
Add a only_on_screen container widget
2017-03-04 04:06:21 +01:00
Kevin Zander 3f6df8ddee Fix Luacheck 0.19.0 release Travis breaks 2017-03-03 16:41:12 -06:00
Uli Schlachter 2b2612314c Add a only_on_screen container widget
Fixes: https://github.com/awesomeWM/awesome/issues/1565
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-03 13:25:28 +01:00
Kevin Zander 7f6763fb00 Add awesome.version to globals for tests. Will always show util.deprecate output 2017-03-02 18:15:59 -06:00
morethanoneanimal 1c71260389 Replace improperly used asserts with warnings.
Add awful.spawn noop function to hooks.lua test. Previously it was nil.
2017-02-21 00:31:33 +01:00
Emmanuel Lepage Vallee e221f8414c tests: Validate wibar geometry in the struts test
Prevent #1523 from regressing
2017-02-13 22:41:25 -05:00
Emmanuel Lepage Vallee 4a4864bb75 doc: Add another declarative syntax example
Better show the composite/encapsulated widgets
2017-02-12 22:19:08 +01:00
Emmanuel Lepage Vallee f448a604b7 cmake: Add a --DOC_NO_DASH option to the doc examples framework
This way it can be used in documentation pages.
2017-02-12 22:19:08 +01:00
Emmanuel Lepage Vallee 7753d830c1 tests: Test the place container. 2017-02-11 16:10:13 -05:00
Emmanuel Lepage Vallée fe4d6404a6 Merge pull request #1376 from Elv13/disable_wibox_in_tests
tests: Add a very dirty hack to break wibox for multiscreen tests
2017-02-07 11:38:33 -05:00
Emmanuel Lepage Vallee 83e176fa32 tests: Break wibox for multiscreen tests (on purpose)
This commit add an option to shim the whole wibox module when
running multi-screen tests. This is intended to lower the test
runtime when coverage is enabled.

In theory, most of that code is already covered by the
test-screen-changes suit.

This makes the coverage builds about twice as fast. This is
necessary because there is a large number of timeouts due to
limited resources on the Travis build system.
2017-02-07 11:37:07 -05:00
Emmanuel Lepage Vallee 631e75a757 ewmh: Use the request:: API in the border_width / wa callback
And stop listening to property::geometry, it's no longer needed.

This also remove messing up the border without saving it
somewhere. The concept is sound, but not the implementation.
2017-02-07 11:13:15 -05:00
Emmanuel Lepage Vallee 3ca363115d tests: Add tests for #1321 2017-02-07 11:12:40 -05:00
Daniel Hahler 52170f575f test-current-desktop: make wait_for_current_desktop fail directly (#1516)
We should get the expected state before already.

Ref: https://github.com/awesomeWM/awesome/issues/1495#issuecomment-277098634
2017-02-06 19:55:08 +01:00
actionless 3cc613fa20 test(awful: hotkeys_popup): add a minimal test 2017-02-05 21:32:43 +01:00
copycat-killer 1a5f6b7ad2 client: Allow clients to have shapes
Also fixes awful.client.shape docs

Closes #1507
2017-02-03 17:48:28 -05:00
Daniel Hahler d005640f92 test-current-desktop: add extra step when killing a client
Ref: https://github.com/awesomeWM/awesome/issues/1495#issuecomment-277098634
2017-02-02 23:02:54 +01:00
Uli Schlachter d494b87fb7 tests/_client.lua: Improve error with Gtk 2 (#1506)
In Gtk 2, the "first" argument to set_geometry_hints() is not optional.
However, this code does not provide any argument here. Improve the error
message in this case by checking for Gtk 3.

Reference: https://github.com/awesomeWM/awesome/issues/1495
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-02 22:30:04 +01:00
actionless 79a60b3009 fix(awful: key): clone table with user data
closes #1401

fix(tests: awesomerc): use `awful.key.execute` instead of local helper function
2017-01-30 18:19:24 +01:00
Emmanuel Lepage Vallee 1a7c816182 doc: Fix the progressbar examples indentation
Correctly, this time
2017-01-27 19:28:46 -05:00
Emmanuel Lepage Vallée 5a914b3496 Merge pull request #1198 from psychon/wibox-shape
Wibox: Add gears.shape support
2017-01-26 05:30:42 -05:00
SammysHP 37f0b7e3bf prompt: Make awful.widget.prompt themeable
Adds new optional properties to the theme:
    prompt_fg
    prompt_bg
    prompt_fg_cursor
    prompt_bg_cursor
    prompt_font
2017-01-23 13:15:09 +01:00
Emmanuel Lepage Vallee a6161d1229 tests: Test the prompt highligher 2017-01-22 01:14:20 -05:00
Emmanuel Lepage Vallee 928f7b04b4 prompt: Add a key filter example 2017-01-20 01:09:30 -05:00
Emmanuel Lepage Vallee f6cce940a5 prompt: Add a Vi like prompt parser
Otherwise hooks that modify the command are not documented well
enough.
2017-01-20 01:09:29 -05:00
Emmanuel Lepage Vallee 4934697817 prompt: Add a more complete hook example 2017-01-20 01:09:29 -05:00
Emmanuel Lepage Vallee 53d32d362a prompt: Unit test the example 2017-01-20 01:09:29 -05:00
Emmanuel Lepage Vallee e8f82c332a shims: Add basic shims for the key and mouse grabbers 2017-01-20 00:22:49 -05:00
Emmanuel Lepage Vallee 5e1d2ce0ad shims: Add the string.wlen function 2017-01-20 00:22:49 -05:00
Yauhen Kirylau 316734a681 move `theme_assets` from xresources theme to `beautiful` module. (#1219) 2017-01-14 04:09:54 +01:00
Daniel Hahler 162685bf30 Merge pull request #1367 from psychon/resizes
Fix some possible errors with resizes.

Fixes https://github.com/awesomeWM/awesome/issues/1368.
2017-01-08 23:42:52 +01:00
Daniel Hahler ec9a981dd7 tests: move coverage setup into tests/run.sh
This allows for `DO_COVERAGE=1 make check` with local tests (where
`CI=true` is not given).
It uses the new environment variables to configure the default theme,
instead of creating a temporary config/theme.
2017-01-08 20:34:13 +01:00
Daniel Hahler eacc49243b tests/examples/CMakeLists.txt: invoke luacov with `lua` directly 2017-01-08 20:34:13 +01:00
Daniel Hahler 6aee6c2053 ci: overhaul coverage processing
- Execute the tests without compiling, and don't mess with the source
   files when coverage is enabled.
   This ensures that the coverage report lines are correct.
   This disables the doc tests, as their results would be unused.
   Hack: it still expands macros on util.lua, because of
   `util.get_themes_dir()` and `util.get_awesome_icon_dir()`, which might
   be moved later.  Ref:
   https://github.com/awesomeWM/awesome/pull/1239#discussion_r93828178.
 - ensure that BUILD_APIDOC and DO_COVERAGE are not used together
 - awesomeConfig.cmake: add DO_COVERAGE as an option
 - Travis: only install codecov with DO_COVERAGE=codecov
 - Travis: do not use set -v; use set -x with DO_COVERAGE
 - do not use trailing slashes with dirs in tests/examples/CMakeLists.txt / .luacov
 - Use latest luacov (0.12.0-1) again
   This reverts parts of 4cc6a815.
   I think it is better to fix any failure that 4cc6a815 tried to work around.
 - Travis: simplify/fix require('luacov') for functionaltests
 - tests/examples/CMakeLists.txt: resolve ../.. in SOURCE_DIR
 - tests/examples/CMakeLists.txt: add DO_COVERAGE to env
 - Cleanup/simplify .luacov: work with SOURCE_DIRECTORY alone
 - tests/run.sh: pass through / set SOURCE_DIRECTORY when running awesome
 - tests/run.sh: resolve source_dir
 - use DO_COVERAGE from env only
2017-01-08 20:34:13 +01:00
Uli Schlachter e659b80f36 Refuse attempts to resize clients to invalid size
X11 does not allow to resize a window to size 0x0. Also, there are some
possibilities of integer overflows in our case. We tried to handle this
already, but there was a loop-hole: If the too-small-value is only
produced after applying size hints, then this was not caught.

Fix this by applying size hints before checking if the resulting size is
valid. However, this means some check needs to be duplicated to handle
the possibility of integer underflows while applying size hints.

Helps-with: https://github.com/awesomeWM/awesome/issues/1340
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-08 15:35:56 +01:00
Uli Schlachter f8b735fa24 test client: Add support for setting some size hints
This adds a new argument to the test client spawning function that will
make the test client window set a resize increment property.

The API here is starting to a bit ugly, but since this is not any user
facing API, that should not be a problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-08 15:35:56 +01:00
Emmanuel Lepage Vallee 6158091422 doc: Partially revert the indentation changes
This messes up the doc
2017-01-03 00:12:28 -05:00
Emmanuel Lepage Vallee 767cda5830 doc: Fix some example tests indentation
When `DOC_NO_USAGE` is set, the examples need 4 spaces as per the
markdown spec.
2017-01-03 00:10:18 -05:00
Emmanuel Lepage Vallee ad203232c4 cmake: Add an extra space to the @usage code
Otherwise commented lines look like ---- My comment
instead of -- -- My comment. This wasn't a problem before the
intentation fix commit, but it is now.
2017-01-03 00:07:57 -05:00
Daniel Hahler 9d69825766 Merge pull request #1345 from psychon/test-runner-speed2
Test runner speedup
2017-01-03 02:13:44 +01:00
Daniel Hahler 4b9e8e232d Merge pull request #1341 from psychon/modeline
Lots of fun with vim modelines
2017-01-02 19:56:06 +01:00
Uli Schlachter f7025e2f73 Fix tests/run.sh
Commit a944636c02 "bashified" tests/run.sh for some reason.
Afterwards, commit 4abd820051 fixed some of the fall-out.
However, there is still a problem left.

We have "set -e" in this script. Thus, whenever some command exits with
status 0, the script abort. When the variable errors is zero/unset, the
command "((errors++))" has exit status zero. Thus, this instruction
caused the shell script to abort. This was not intended.

Fix this by using "((++errors))" instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:35:13 +01:00
Uli Schlachter 6534208f62 tests/_runner.lua: Use less waiting
Before this, the test runner used a timer which fired every 0.1 seconds
to "do its thing". Many of these waits seem unnecessary.

This commit makes the test runner wait 0 seconds for the first call of a
step function. Only following calls will have a timeout of 0.1 seconds
applied.

A full run of the test suite (tests/run.sh without further arguments)
took about 100 seconds before this change. After this change, we are
down to 60 seconds. This is almost factor two faster! (Well, five thirds
is the exact number, so factor 1.66)

(The numbers are best out of three runs. The "before" number is rounded
down while the "after" number is rounded up.)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter edff48f133 test-awful-client.lua: Fix indentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter a1b5782e90 test-awful-client.lua: Wait for c:kill() to be done
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter 30912c6f24 test-geometry: Wait for c:kill() to be done
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter 0d8106c6dd test-leak-client.lua: Wait for c:kill() to be done
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter 0dff0c308a test-geometry.lua: Fix indentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter 5bbe6747fc tests: Add calls to awesome.sync() where needed
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter 0f755c8f12 Fix error handling in _client.lua
Previously we got the following unhelpful error message:

tests/_client.lua:98: bad argument #2 to 'assert' (string expected, got
userdata)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 16:10:38 +01:00
Uli Schlachter c65cf9d3d3 test-struts.lua: Add tests for client struts
These new tests currently fail.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:27:28 +01:00
Uli Schlachter 9089874193 Fix indentation in test-struts.lua
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 14:51:29 +01:00
Uli Schlachter d893e42440 Add missing modelines to tests/*.lua
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 14:05:51 +01:00
Uli Schlachter 7d3b7fc48a Add vim modelines to all CMake files
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 14:02:14 +01:00
Uli Schlachter 46c32d9df1 tests/example: Add vim modelines
This uses DOC_HIDE magic in the actual test code, except for the
template.lua files which do not have it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 13:59:38 +01:00
Uli Schlachter af59d52ddf Slightly change DOC_HIDE magic
The following commits will add DOC_HIDE uses that are not at the end of
the line, but the beginning. Hence, drop the requirement that it appears
at the end of the line and change the ".+" at the beginning into ".*".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 13:58:35 +01:00
Daniel Hahler 58773488e4 tests: do not set -x by default on Travis (#1318)
This is rather noisy, and the test runner should not require this anymore for debugging.

[ci skip]
2016-12-28 12:43:00 +01:00
Daniel Hahler 68de588f21 tests: fix indenting/style (#1303)
Basically:

> for f in **/*.lua; do vim '+set sw=4' '+norm gg=G' '+wq' "$f"; done
2016-12-27 21:39:08 +01:00
Daniel Hahler 8f8094b57e tests/run.sh: allow to pass full file name
This is easier with shell completion.
2016-12-27 02:43:05 +01:00
Daniel Hahler 8e97ae51c3 tests/run.sh: remove exclamation mark for better copy'n'paste experience
Closes https://github.com/awesomeWM/awesome/pull/1293.
2016-12-27 02:43:05 +01:00
Uli Schlachter 144b9ef697 Add a kind of test for wibox shape support
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-26 13:28:34 +01:00
Uli Schlachter 3f9da4269d Fix test in test-spawn.lua (#1298)
Copy-paste-y I was checking for the wrong result. Another unrelated
problem with the test runner caused me to miss this. Sorry!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-25 15:47:09 +01:00
Daniel Hahler 4abd820051 tests: fix incrementing errors (#1297) 2016-12-25 15:13:22 +01:00
Uli Schlachter 59cd409517 Small cleanup to test-spawn.lua
This removes a duplicate test and moves some "spawn with empty string as
argument" up to the long list of similar tests (and adds error
checking).

I do not see the point of the assert(#client.get() == 0) and so it was
just dropped.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-25 14:50:39 +01:00
Uli Schlachter 461da9ea4b Fix error handling in awesome.spawn()
Commit 5e6a893 broke error handling in awesome.spawn(): Instead of
returning an error message, it would just return its last argument.

This commit fixes that, removes some not-so-helpful warnings, and adds
lots of tests for this code.

Fixes: https://github.com/awesomeWM/awesome/issues/1281
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-25 14:50:39 +01:00
Daniel Hahler fb874122ba tests/run.sh: SHELL=/bin/sh, HOME=/dev/null (#1291) 2016-12-25 03:46:28 +01:00
Daniel Hahler d5b3fa8be0 Merge pull request #1290 from blueyed/tests-run-shellcheck-etc
tests/run.sh: shellcheck and other fixes
2016-12-25 03:43:50 +01:00
Daniel Hahler da415e0f9a Fix tests/test-awesomerc.lua (#1289)
Locally I got this, where only two xterms were opened.

```
% tests/run.sh test-awesomerc.lua
awesome_log: /tmp/tmp.ToAKs6Gw4J/_awesome_test.log
== Running test-awesomerc.lua ==
Error: timeout waiting for signal in step 1/11 (@20).
===> ERROR running test-awesomerc.lua! <===
Error: timeout waiting for signal in step 1/11 (@20).
There were 1 errors!
```
2016-12-25 03:43:24 +01:00
Daniel Hahler 58067834ad tests: remove TEST_QUIT_ON_TIMEOUT/quit_awesome_on_timeout (#1288)
It was set to 1 unconditionally anyway, and does not make sense to parametrize after all.
2016-12-25 03:43:03 +01:00
Daniel Hahler 8c9a1b5491 fixup! tests/run.sh: shellcheck and other fixes 2016-12-25 03:09:43 +01:00
Daniel Hahler a944636c02 tests/run.sh: shellcheck and other fixes 2016-12-25 03:08:35 +01:00
Emmanuel Lepage Vallee 2b462cb2e3 doc: Document the tag `master_fill_policy` 2016-12-21 11:41:30 -05:00
Emmanuel Lepage Vallée 8935ed2a30 Remove traces of the old URL (#1280)
**WARNING**: This breaks the API
2016-12-21 02:03:03 +01:00
Uli Schlachter 11af40b916 Fix luacheck warnings in tests/_multi_screen.lua
This is a partial revert of commit 7901a1c647. The end result is the
same, but the change from that commit is reverted and instead the same
thing is done in a different way.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-19 09:44:26 +01:00
Uli Schlachter 939453cabe Fix luacheck warnings in the logo-tests
Ever since these files were added, these problems existed. I have no
idea what alt_fg is supposed to mean, but since a value of nil is
apparently ok, I just pass in nil directly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-18 18:59:58 +01:00
Uli Schlachter 226bb2cc31 Fix luacheck warnings in themes/xresources/assets.lua
These were introduced by commit 12e1bd6747.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-18 18:57:58 +01:00
Emmanuel Lepage Vallee 7961b8ec4b tests: Test the wallpapers 2016-12-12 13:05:08 -05:00
Emmanuel Lepage Vallee 1368212fb7 tests: Test the `tag` and `tags` rules with multiple screens 2016-12-12 11:49:11 -05:00
Emmanuel Lepage Vallee 7901a1c647 tests: Disable the wallpaper for multi-screen tests.
I really try to avoid doing this, psychon too, but enough is
enough. We don't have a solution and I would rather add more
tests that work than keeping a test that keep "failing" just
to remind us it's there.
2016-12-12 11:49:11 -05:00
Emmanuel Lepage Vallee beb997f848 tests: Test the xresource theme logo generation
As a side effect, this creates valuable SVG assets
2016-12-11 00:10:39 -05:00
Emmanuel Lepage Vallee e01de8d977 tests: Expose the themes to the examples tests 2016-12-11 00:10:39 -05:00
Uli Schlachter 9f2c4719ed Make the piechart deterministic (#1258)
Previously, the API to set the data that should be displayed was
:set_data(t) where t is a table. This table has the labels to use as its
keys and the numbers as its values. With this API, it was not possible
to influence the order in which the "pie pieces" were drawn.

This commit adds and uses a new API called :set_data_list(t). Here, t is
a table with integer keys and tables as values, thus one can iterate
over this with ipairs() and the order is well-defined. The tables used
as values contain the label as their first entry and the number as their
second entry.

Fixes: https://github.com/awesomeWM/awesome/issues/1249
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-07 20:20:09 +01:00
Uli Schlachter 5d81441c76 Make the resize_to_mouse example test deterministic (#1250)
This test has a list of "things" that should be present in the output. This
table is iterated over via pairs(), which means that the output is
non-deterministic and the order of the entries is basically random.

Fix this by using ipairs() to get a deterministic iteration order. This requires
some slight change to the table that is iterated over.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-02 21:23:36 +01:00
Uli Schlachter cb61c1884f Remove a case where a pointer appeared in text tests (#1251)
This printed a table. This will make Lua print the address of the table and
hence the output of this test was non-deterministic.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-02 20:30:10 +01:00
Emmanuel Lepage Vallée 883b5934c0 Merge pull request #1236 from Elv13/fix_new_tag_rule
rules.new_tag: Fix when the tag screen doesn't match the client
2016-12-01 19:53:17 -05:00
Emmanuel Lepage Vallee 771f5a13c6 tests: Bump the timeout to 3 minutes.
There we go again... When hitting a slow CI node, there is again
timeouts when doing the multi-screen tests. As no solution to
bug leading to this has been found, the only thing to do is
increase the timeout.

Hopefully this commit will be reverted soon.
2016-12-01 19:34:46 -05:00
Uli Schlachter 3a7e14e5d7 Improve API of test/_client.lua
The first return value was always true. How useless...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-01 15:32:31 +01:00
Uli Schlachter f9cdc98c73 Fix spawn callbacks
Spawn callbacks were never invoked when no startup-notification-rules were
given. This commit fixes the code so that "startup done" callbacks are also
called when no rules were given.

Fixes: https://github.com/awesomeWM/awesome/issues/1218
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-01 15:32:21 +01:00
Emmanuel Lepage Vallee 28486527e7 tests: Add a `new_tag` rule multi-screen test 2016-11-27 04:57:35 -05:00
Daniel Hahler aeab2a70e9 Fix whitespace warnings reported by luacheck (#1229) 2016-11-21 22:38:23 +01:00
Emmanuel Lepage Vallée 92a494a799 Merge pull request #1182 from psychon/screen_swap
Screen swap
2016-11-07 19:23:48 -05:00
Uli Schlachter b2e0e55fc0 tests/run.sh: Inherit $HEADLESS (#1201)
Via this, I can set HEADLESS=1 in my wrapper-GNUMakefile that I use and
"make check" will no longer open a new window that gets in my way.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-31 23:22:31 +01:00
Uli Schlachter 3ba07d77a6 Fix three typos
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-30 15:17:27 +01:00
Uli Schlachter 7712383475 Add a test for screen :swap()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:36:31 +02:00
Uli Schlachter c218b1da72 Test and fix swapping clients
The code in luaA_client_swap() is incorrect, because
luaA_object_emit_signal() already pops the arguments to the signal.
Still, the code here tried to remove the arguments from the Lua stack
again, thereby corrupting the stack (removing more items than there are
in the stack).

Normally, popping more things from the stack than it has entries
silently corrupts the Lua stack. Apparently this doesn't necessarily
cause any immediate issues, because this code has been broken since nine
months and no one noticed. This mistakes was introduced in commit
55190646.

This issue was only noticed by accident. Thus, this commit also adds a
small integration test that exercises this bug. This test catches the
issue, but only on Travis, because there we are building our own version
of Lua 5.3 and that one has assertions enabled.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:34:45 +02:00
Uli Schlachter d07fc822a1 Fix awful.tag.object.get_gap_single_client (#1190)
The usual "a or b"-trick to simulate C's ?:-operator does not work when
"false" is a valid value. Fix the code to handle this correctly and add
a short unit test which would have caught this problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-26 01:43:45 +02:00
Emmanuel Lepage Vallee 072ff10cf0 tests: Test the slider widget. 2016-10-12 02:24:47 -04:00
Emmanuel Lepage Vallee a2748a1fa3 tests: Test client focus stealing filters. 2016-10-04 01:00:55 -04:00
Daniel Hahler 86bc579649 Improve messages with tests/examples/CMakeLists.txt 2016-10-01 17:24:44 +02:00
Daniel Hahler 84e7875e50 minor: fix doc for tests/examples/CMakeLists.txt 2016-10-01 17:24:03 +02:00
Uli Schlachter da6012da3e Fix memory leak in the default config on screen removal
The default config had tables like mywibox and mywibox[s] was the wibox
that is visible on screen s. When a screen is removed, nothing cleans up
these tables and so the screen and the wibox could not be garbage
collected. The same applies to the layoutbox, taglist etc.

This commit removes the global mywibox table and instead saves it as a
property on the screen. This way, the screen is not explicitly
referenced and when it is removed, the screen, its wibox and all of its
widgets become unreachable and can be garbage collected.

This commit also updates the docs and the tests that referenced things
(mostly the wibox) via mywibox[s] to now use s.mywibox.

Fixes: https://github.com/awesomeWM/awesome/issues/1125
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 22:46:51 +02:00
Uli Schlachter f9775b91de shims: Add support the new .data property
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 11:11:55 +02:00
Uli Schlachter 502b4139ba Merge branch 'faster-client-deamon' 2016-09-30 10:17:35 +02:00
Uli Schlachter 8dc6c5f502 Rewrite tests/_client.lua
The new client is hopefully faster. Why, you ask?

Instead of spawning a new Lua process each time a test asks for a new window,
there is a "daemon process" which gets commands to open new windows from its
standard input. That way, Lua doesn't have to load LGI all the time and lots of
pointless work is skipped. The daemon process exits when its stdin is closed and
thus should automatically exit when awesome exits.

Fixes: https://github.com/awesomeWM/awesome/issues/1089
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:58:20 +02:00
Uli Schlachter 61d8d74421 Fix test-tooltip.lua: Run the event loop
This test changes the mouse cursor's position and afterwards has an
assert that checks something on the tooltip. This really looks a lot
like it expects the mouse cursor's position to be already updated and
its enter and leave events to be handled. However, this is now how
things actually work.

Fix this by moving the assert into its own step, so that in between the
normal main loop runs.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:36:47 +02:00
Emmanuel Lepage Vallee f25621c94c tests: Test the graph shape. 2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 549d68dcc5 doc: Add more progressbar shape examples 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 7b11f1c1b4 tests: Test progressbat paddings, margins and clip 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee a8568eb969 doc: Add examples for vertical and labelled progressbar 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee b49b859fac tests: Use the new progressbar features in the default test. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 6990cc15dc tests: Add an helper "before and after" method for the layouts
This will avoid a lot of copy paste as the
remove/set/swap/insert/add/remove_widgets/swap_widgets code
is identical beside the method name.
2016-09-26 00:40:20 -04:00
Emmanuel Lepage Vallee 50b6c82091 shim: Add basic button support 2016-09-25 22:47:35 -04:00
Uli Schlachter cea5d41518 tests/run.sh: Use dbus-send directly with low timeouts (#1116)
run.sh waits for awesome's startup to be done by having awesome execute "return
1" via its dbus interface. However, by default dbus has a 25 second timeout
before it fails a dbus-send invocation. This defeats the purpose of this
exercise.

So instead of using awesome-client, this commit makes the code use dbus-send
directly and specifies a relative low reply timeout (which should still be
plenty so that this doesn't erroneously fail).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-25 20:28:27 +02:00
Daniel Hahler 8dc98e8c51 Merge pull request #1115 from psychon/timeouts
Don't use sleep to implement timeouts in the test runner
2016-09-25 13:00:31 +02:00
Uli Schlachter a430ac1e23 tests/run.sh: Print special message for timeout
The timeout utility guarantees an exit code of 124 when the process died due to
timeout. Since awesome only ever exits with 0 or 1, we can use this to reliably
detect timeouts and print a matching message.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-25 06:00:15 +02:00
Daniel Hahler 9b7e655afe Merge pull request #1111 from psychon/assorted-fixes
Some assorted fixes
2016-09-25 01:35:55 +02:00
Emmanuel Lepage Vallee de3a8bb5fb tests: Test the arc chart container. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 15102c1fe9 tests: Test the arc shape. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 2a976951ea tests: The the piechart widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 0a3a71dd45 widgets: Add a piechart widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee d2d2d82af8 tests: Test the pie shape. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 52cca3b8b7 tests: Test the checkbox widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 6128e995f2 tests: Test the radical progressbar 2016-09-24 14:45:08 -04:00
Uli Schlachter 60ee10cfff tests/run.sh: Use the "timeout" command
coreutils provides a timeout command. Use that instead of (badly) inventing our
own version of it. This "timeout" command seems to be new. Let's hope everyone
has it and think about alternative solutions only when needed.

Fixes: https://github.com/awesomeWM/awesome/issues/1075
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 15:56:36 +02:00
Uli Schlachter 62d0961994 tests/run.sh: Show awesome's exit code
When awesome exits with a non-zero code, this is something interesting that we
should log. Do so.

The "set +e" / "set -e" dance is required so that we do not abort because the
wait builtin returns a non-zero code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 15:55:24 +02:00
Uli Schlachter 86ee5bb750 tests/run.sh: Don't fail because of grep
This script runs under "set -e", so any command exiting with a non-zero status
makes it abort. However, we do not care about failures from grep to find
anything, so handle that case gracefully.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 15:53:35 +02:00
Uli Schlachter 489aa4dc24 Improve behaviour of GC'd objects
Before this commit: When we are GC'ing an object, we clear its metatable, since
otherwise crashes could occur in various places. This means that if someone
tries to use such an object, they get an unhelpful error message like "attempt
to index userdata object" and they don't understand what the problem is. Also,
this means that foo.valid does not actually work after GC.

This commit changes this behaviour. Instead of setting an empty metatable, we
now create a metatable with an __index and __newindex method. These metamethods
produce better error messages that they sat the underlying object was already
garbage collected. Better yet, the __index metamethod makes foo.valid be false
instead of causing an error, so that the existing machinery for detecting
invalid objects continues to work.

This commit also adds a functional test that verifies this behaviour.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
Emmanuel Lepage Vallee c7f5a9acd3 tests: Fix awful.screen tests
To ensure that some features such as SNID rules work, we need
to ensure that the screen isn't set by other code paths. Only
a single algorithm can be executed for the screen. As soon
as many algorithms are executed on events such as "manage", it
will most likely regress again.

This commit make sure of that by disabling the default normal source
of c.screen. After that, any other c.screen changes can be
considered bugs.
2016-09-24 00:19:10 -04:00
Daniel Hahler b4d6bfa4db Travis: fix codecov (#1105)
tests/run.sh: no slash with --search lib

Fixes https://github.com/awesomeWM/awesome/issues/1049.
2016-09-20 19:53:10 +02:00
Crazy Lemon ffa7519730 Has the example test runner unset env variables that would interfere (#1106)
with using LUA_PATH for the `package.path` default valua for the shim tests
2016-09-20 19:36:23 +02:00
Uli Schlachter 75ed165ae6 Test & fix a bug with dbus.disconnect_signal (#1096)
The code was written so that it assumes that disconnecting the last signal also
removed the corresponding entry in the signal array. This lead e.g. to an
index-out-of-bounds access in some cases.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-18 12:50:40 +02:00
Emmanuel Lepage Vallee 35c0476c86 tests: Increase time limit to 120 seconds
The "test launching client on a specific screen" suit is very slow.

However, it is also necessary to avoid issues such as #1069 or #154
from regressing again.

This is a temporary fix until a faster test client "daemon" is
developped.
2016-09-07 00:40:30 -04:00
Emmanuel Lepage Vallee edf7fb40b3 tests: Test moving tags between screens. 2016-09-05 17:13:53 -04:00
Emmanuel Lepage Vallee 760e72f94a tests: Test spawning client on a specific screen. 2016-09-05 17:13:53 -04:00
Emmanuel Lepage Vallee db73887b9f tests: Add a framework to make it easier to test multiple screens.
While testing using "the real deal" and with all the tests would be
better, it would add a lot of complexity to the testing framework.

This module generate multiple multi-screen scenarios and some obvious
issues that they can cause. Over time, as more steps are added, it
will provide "good enough" testing for multiple screens.

Individual test suits can require() this utility to replicate their
steps for each multi-screen scenarios.
2016-09-05 17:13:53 -04:00
Emmanuel Lepage Vallee a0b40bfd8f tests: Try to detect client "manage" signal race conditions.
See #1028
2016-09-04 02:52:16 -04:00
Uli Schlachter cf89f108ac Make use of awesome-client commands
This uses the new support introduced in f0f31bc305 in the docs and in
tests/run.sh, removing an useless use of cat/echo.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-08-31 17:45:37 +02:00