Commit Graph

902 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallée 59b31e74b3
Merge pull request #2988 from Elv13/notif_rules_groundwork
Fix multiple notifications issue
2020-02-15 17:59:28 -05:00
Emmanuel Lepage Vallée 10e32198e7
Merge pull request #2982 from Elv13/modeline
Support shebangs (#!), modelines, API levels and add more doc.
2020-02-15 17:53:41 -05:00
mergify[bot] fd237b9cd8
Merge pull request #2991 from psychon/cleanup_tag_history
Cleanup tag history on screen removal
2020-02-13 00:31:04 +00:00
Uli Schlachter 38a2a524a7 Cleanup tag history on screen removal
The tag history kept a strong reference to a screen even after that
screen was removed. This prevented the garbage collector from cleaning
up.

Fix this by getting rid of the tag history on screen removal.

Related-to: https://github.com/awesomeWM/awesome/issues/2983#issuecomment-584249568
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-02-12 20:33:21 +01:00
Emmanuel Lepage Vallee ad880080f4 tests: Better test how the `box` notification handle screens.
Right now, there is still a memory leak *only* when there is active
`box` notification when the screen is removed. I failed to identify
where *this* leak is comming from. The previous few commits fix
~5 other leaks.
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 21caa19a21 naughty: Add a way to revert to the legacy mode.
When `rc.lua` will use the new notification API by default, we need
a way to revert back to the lagacy mode to be able to test it.
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee ee80fe052f init: Add an API level concept to `capi`.
The API level concept is something used by other projects such as
Android and iOS to allow deprecated features to be removed and the
bahavior to be altered without breaking compability with existing
code.

The same will apply to AwesomeWM. The current API level is "4" and
as long as config use this, no deprecation or bahavior change will
be exposed. If the user sets it to an higher value or we release
the next major version and new users start to use the, then current,
default config, they will use the new API level.

The the far future, if ever, we could fork the entire Lua libraries
to support legacy APIs. This would only require to keep the core
API support for those legacy calls. In the meantime, `gears.debug`
will use this to manage the deprecation and some conditional code
will be added as a last resort attempt to preserve behavior
compatibility while moving forward with breaking changes.
2020-02-08 17:18:01 -05:00
Emmanuel Lepage Vallee c616400239 cmd: Add an option to force the command line arguments.
The next commit will add modeline support. By default, modelines have
the final work on which options to set. However, mostly for testing,
this isn't flexible enough.
2020-02-08 17:12:56 -05:00
Emmanuel Lepage Vallee 20743a9a16 Remove all usage of the now deprecated `awful.rules`. 2020-01-19 02:59:10 -05:00
Emmanuel Lepage Vallee 171a14dbc8 tests: Port the hardcoded awful.rules test to the sequence template. 2020-01-19 02:58:41 -05:00
Emmanuel Lepage Vallee 71c230035c rules: Move `awful.rules` to `ruled.client`.
From now on, all core object will have their own rules. `awful.rules`
hardcodes some client specific code. All `rules` module have some form
of class specific code. This code will now be part of a new module
called `ruled`. Since a year or so, a lot of work has been done to
refactor the rules on top of the shared `gears.matcher` class. This way
there wont be as much duplication.
2020-01-19 02:58:37 -05:00
Seth Barberee ab6381686e add calendar_popup pic to doc 2020-01-17 16:02:18 -06:00
Emmanuel Lepage Vallee 839dddee25 tests: Test the tag `request::layouts`. 2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee 6b427e73a8 tag: Add a request::layouts signal and append/remove layout. 2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee 5818de41ce awful: Rename awful.ewmh to awful.permissions.
It has nothing to do with EWMH since a long time. It was already used
for the requests, so lets formalize this.
2020-01-11 15:43:30 -08:00
Emmanuel Lepage Vallee 8365dbc1b6 tests: Test rc.lua `c:activate()` actions. 2020-01-11 15:43:15 -08:00
Emmanuel Lepage Vallee b51a20670b tests: Test client.active. 2020-01-11 15:43:15 -08:00
Emmanuel Lepage Vallee 04c757322c client: Turn `rc.lua` logic into a new `request::border` signal.
The default `rc.lua` was using the focus/unfocus signals to set
the border color along with `awful.rules`. This logic block was
no longer aligned with the rest of `rc.lua` since it was
the only place where `beautiful` variables where only used by
`rc.lua`.

On top of this, the new request handler also has extra contexts
for the urgent and floating/maximixed use cases. So it can be used
by themes to implement much smarter borders than just focus based
ones. They were previously limited by the fact most of the
(un-monkey-patchable) logic was in `rc.lua`.

Note that this commit also shuffle the awful.rules order between
the titlebar and the border and changes the tests accordignly.
After some consideration, I came to the conclusion the previous
behavior was bogus and the fact that the placement tests required
to know about the titlebar height is simply a proof of that. The
change was required in this commit because since the border is no
longer in the default rules, a new buggy edge case surfaced.
2020-01-11 15:43:11 -08:00
Emmanuel Lepage Vallee ba5385dd40 client: Update existing code to use `c.active`. 2020-01-11 14:43:56 -08:00
Emmanuel Lepage Vallee 067bcaca60 client: Rename the `manage` and `unmanage` signals.
They currently fit the general concept of a `request::` in the sense
that they are not property related and have "request handlers".

The commit also add deprecation for signals.

The reason for this fits within the larger standardization project.
Non-namespaced signals will eventually be renamed. This has started
a long time ago.

What is old is new again. Once upon a time, there was a `startup`
parameter to the `manage` signal. It is now back in the form of
a context.

Finally, this commit removes the `manage` section of `rc.lua`. It no
longer did anything worthy of being in the config. Each of its
important parts have been moved out over the years and the last
remaining bit is always required anyway. The code has been moved
to `client.lua`.
2020-01-11 14:43:56 -08:00
Seth Barberee b9bb9cbe69 add docs for gears.cache 2020-01-05 20:58:36 -06:00
Seth Barberee d05b7d80f1 gears.string doc revamp 2019-12-19 09:52:03 -06:00
Seth Barberee 9e3c418a03 add gears.table.cycle_value (#2942) 2019-12-12 22:10:10 -08:00
Emmanuel Lepage Vallee b48527b672 tests: Test more of awful.mouse 2019-12-06 01:41:42 -05:00
Emmanuel Lepage Vallée d2b7d292b0
Merge pull request #2939 from SethBarberee/layoutbox-doc
Add layoutbox example
2019-12-06 00:18:24 -05:00
Emmanuel Lepage Vallee 90ddbb9cd0 doc: Add `local` in the launcher example.
It caused some versions of luacheck to bark.
2019-12-05 23:51:00 -05:00
Seth Barberee 431791accc add layoutbox example 2019-12-05 23:48:55 -05:00
Emmanuel Lepage Vallee 38b5527825 tests: Test adding and removing key/mouse bindings on existing clients. 2019-12-05 22:50:02 -05:00
Emmanuel Lepage Vallee a53ff7418e tests: Add more global awful.key in test-awesomerc.
This forces the hotkey popup to have pages.
2019-12-05 22:48:56 -05:00
Seth Barberee 7440cf66f0 more docs for launcher (#2935)
Co-Authored-By: Aire-One <Aire-One@users.noreply.github.com>
2019-12-04 00:08:40 -05:00
mergify[bot] a0386dad91
Merge pull request #2921 from Aire-One/doc_fix_modules_summaries
[Draft/Proposal] DOC - Fix modules summaries.
2019-11-29 06:22:34 +00:00
Aire-One 3e6c33af64 Add imagebox doc example for `resize` property. 2019-11-28 13:53:59 +01:00
Aire-One 86a9bbfd71 Improve the `wibox.widget.imagebox` descrition.
* Add a better descrition for the `imagebox` role in the wiboxes system ;
* Improve image + code render and integration into the descrition ;
* Add a second code exemple to show both coding style (imperative and declarative).

I think the user can now have a better overview of what's a `wibox.widget.imagebox` and how to use it.
2019-11-28 13:53:59 +01:00
Aire-One fcc3d0b590 Add an option to draw clients.
Change how wibox are drawn to build a more flexible function reusable in the context of clients.
Add `clients` option to the template. This new option needs an associative table `{ ['label'] = client }` to work. Where label will be a text rendered on the middle of the client area.
Add a new example: `texts/examples/screen/tiled_clients.lua`.
2019-11-28 13:31:21 +01:00
Aire-One 3791daaeaf Add wibar drawing to screen properties images. 2019-11-22 14:40:21 +01:00
Aire-One 92f698bbae Add an option to draw the wibar on screen images.
Add a new option to the screen image template: `draw_wibar`.
This option draw the wibar on the generated image.
2019-11-22 14:40:21 +01:00
Aire-One 3830e9de35 Invert rulers insertion order.
Rulers insertion order impact the result of the bubble sort algorithm.
By inverting the order, we can make the output image looking more natural.

Awesome's screen properties can be seen like this:
* The screen has a geometry (its size) ;
* Inside there is the workarea ;
* Inside there is the tiling_area.

It seems better to draw rulers in this order.
2019-11-22 14:39:52 +01:00
Emmanuel Lepage Vallee ee331a4eff keygrabber: Remove the hardcoded way to add keybindings.
There is now a real API for this.
2019-11-09 16:43:53 -05:00
Emmanuel Lepage Vallee 944ef213e6 tests: Try both the `args` and parameters based `awful.{key,button}`. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4723c3218a tests: Make sure the legacy buttons/keys method are converted back. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 12a7d026c2 tests: Test the new key/button binding API 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee afbb3b7faf shims: Add the legacy _keys and _buttons to the client shims. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee f4cfb99cde shims: Update the `button` and `key` shims to be objects.
Now that something actually tries to set the index handlers, it
cannot be a dumb function anymore.
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 45823f230a capi: Move from `.data` to `._private` for the property data.
This will bring the CAPI classes closer to the gears.object ones.

Fixes #2897
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4501f0e768 Allow to add and remove keys and buttons.
Another step in moving these APIs toward the common object oriented and
declarative paradigms used by other APIs.

This commit introduces the `awful.keyboard` module. It currenly only
exists as a placeholder for the first few append/remove function, but
will grow in scope in another pull request to expose the currently
private modifier APIs and to provide keybindings collision detection
and replace some of `awful.hotkey_popup` business logic.

The `keygrabber` tests which uses root keybindings are disabled for
now to keep the commit size small. This is necessary since the shims
will need many iterations of changes before this work again with the
new syntax.
2019-11-09 16:42:06 -05:00
actionless 68651477fb refactor(test: awesomerc: hotkeys): imitate fake vim client instead of depending on vim as test dep 2019-10-18 19:02:47 +02:00
Xinhao Yuan 0e8dd4c1c9 Added more tests to check partial maximization handling, which require wmctrl as an optional dependency. 2019-10-17 18:54:29 -04:00
Xinhao Yuan 33570e45d7 Added a test to check if window state is restored after a client unmaximizing itself. 2019-10-16 18:23:21 -04:00
mergify[bot] 344964a44a
Merge pull request #2529 from actionless/hotkeys-popup-dont-show-empty-groups
fix(awful: hotkeys_popup): don't show group label if group itself is empty
2019-10-12 22:14:48 +00:00
actionless 0374bf1b1b test(awful: hotkeys_popup): test pagination and app-specific hotkeys (on vim example) 2019-10-11 15:33:43 +02:00
Emmanuel Lepage Vallee 2c08c2fa39 quality: Port all legacy `:buttons()` to `.buttons`. 2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee fa414a86a3 tests: Test `widget:add_button()` 2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee b23a2e81c5 tests: Stop using the legacy layoutbox constructor.
(done in a commit so the CI can test some commits with the old
constructor)
2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee cbb90d8bd1 root: Turn `root.keys()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 296ad18922 client: Move the `c:keys()` method to a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 29e804a4f8 drawin: Turn `:buttons()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee d5dd3fc794 tests: Test root.buttons
Try both legacy and standardized code paths. Also try invalid mixes of
them in case some modules abuse of rc.lua and ingest the wrong format
by accident.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 141aca2432 root.buttons: Move to Lua.
This is the groundwork commit to support using `awful.button` objects in
`root.buttons`.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee b1c81c4258 awful: Set a miss handler for capi.root
There is no better place to put it and need to always be required
for backward compatibility. Given Awesome no longer works properly
without `awful`, I put the code there.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 95500ea71c root: Add support for setting a miss handler.
This will allow to port some functions from C to Lua, such as supporting
`awful.key` directly when setting the buttons.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 3aafa64ea7 tests: Import the backward compatibility API for all the tests.
This isn't very nice and pulls all sort of almost useless code into
the shims, making them less atomic. However the next few commits
will start another round of API standardization and the compatibility
layer wont be optional anymore.
2019-10-05 18:06:50 -04:00
Aire-One dd69936bed Add a `gen_vertical_space` function to keep spacing from missalignment. 2019-10-05 17:16:22 -04:00
Aire-One 4abb05c590 Align timeline dots and text. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallée ffe7c4d1cc Apply suggestions from code review
Thanks to @Aire-one for those fixes!

Co-Authored-By: Aire-One <Aire-One@users.noreply.github.com>
2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee c2a2c789e6 doc: Add example sequences for the tags. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee fa2433192a doc: Add some screen example sequences. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee 271e2822a7 build: Allow Awesome to be built with luarock LGI. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee 9c0e16e623 doc: Add examples for the various maximization. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee 12f28305a0 tests: Add a sequence template.
This template allows to display a sequence of events for the clients,
tags and screens. Currently, it is hard to display images where the
state of an object is more complex than "here how it was before" and
"here how it is now". With this template, it is possible to have a
timeline of events from the initial states to the final states.

Now, as the line count shows, this isn't small. It is in fact an
enormous template. Worst still, this commit is the first *half* of
it. The second half adds the ability to `print()`, display
inline code and support mouse and keyboard events. The code also isn't
world class. Maintaining this template might be non-trivial in the
long run. I am fully aware of those issues. On the other hand, there
is ~100 places where this will be used once the entire
"new rule library" project is completed. This will bring the ~1.2k
line of code to ~12 lines per consumer. From that point of view,
it makes a lot more sense to merge this given how useful it is
at explaining changes within the "core objects".

It is also important to keep in mind that there is currently very
little or no documentation (beside the mandatory one-liner summary)
for these concepts. Those are the most important aspects of AwesomeWM
API and they are the least documented. This is just wrong.
2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee 6b4b09adc5 doc: Fix the UML template svg generation.
It was mixing the actual HTML relative path with the build directory
path. This doesn't work universally. It didn't work on `awesome-www`
builder.
2019-10-01 02:07:05 -04:00
Emmanuel Lepage Vallée 85c8d5e205
Merge pull request #2854 from Elv13/uml_magic
Add some navigation helpers to the doc (in the form of UML tables)
2019-10-01 00:56:20 -04:00
Emmanuel Lepage Vallee 0419de2a60 tests: Test the screen name. 2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee 994034934e tests: Test `s:split()`. 2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee 3a12e6d274 tests: Test Lua side screen management. 2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee 68488f6218 tests: Test screen.automatic_factory 2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 553cafccde tests: Test the error notifications when no screens are present.
This happens in early initialization when AwesomeWM is started with
`--screen manual`.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 067f8f4ebf tests: Use --screen manual for both code coverage jobs. 2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 53fc364ede shims: Update to handle Lua-side screen managment. 2019-09-29 18:20:15 -04:00
Emmanuel Lepage Vallee fa7f1d689e 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.
2019-09-29 18:20:15 -04:00
Uli Schlachter 0bc22aea85 client shims: Remove some duplicate code
Both commit 44e6b2d24e and 4eda67ce54 added the same function to this
file (and by the commit message, the later was intended to do so, while
the former has an unrelated commit message (but does not contain any
other changes)).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-09-21 13:44:38 +02:00
Daniel Hahler dc98eade3b
naughty: fix extra newline with only title/message (#2870)
* tests/test-naughty-legacy.lua: s/counter/added_counter

* naughty: fix extra newline with only title/message

With only title or message it should not have an extra newline.

Fixes: https://github.com/awesomeWM/awesome/commit/423aeebe8#commitcomment-35062951
2019-09-19 02:11:18 +02:00
Daniel Hahler caf9a26660
tests: runner.run_steps: add fname/lnum for failed steps (#2877) 2019-09-14 14:35:20 +02:00
Daniel Hahler 13ea02eeeb
tests/run.sh: do not export XDG_CONFIG_HOME (#2876)
Only set it for the "awesome" process invocation.
2019-09-13 17:55:27 +02:00
Daniel Hahler 9b86a03b66
tests: do not export build_dir (#2875)
If really necessary this should be an uppercased var, but it is only
used with test-gravity.lua, where we can just rely on `$PWD` being the
build dir.
2019-09-13 17:55:06 +02:00
Daniel Hahler 4c31a0f745
tests: improve test-selection-transfer: use "wait_per_step" option (#2874)
* test-selection-transfer: clarify comment / condense

Noticed this via flaky coverage for the check after the "wait_a_bit"
block.

Ref: https://codecov.io/gh/awesomeWM/awesome/pull/2872/changes#L193

* tests/_runner.lua: add support for wait_per_step
2019-09-13 16:39:40 +02:00
Daniel Hahler a7674f2359
tests/run.sh: output "awesome --version" (#2872)
Might be good to have a short version of it (single line), but extra
lines are indented, so this seems to be OK.

This helps / shows when the built version is not up-to-date (e.g. after
git-bisect), and serves as a basic check that it can be run in the first
place.
2019-09-13 16:02:22 +02:00
Daniel Hahler 0cbf536269
test-naughty-legacy.lua: harden/cleanup (#2873) 2019-09-13 16:00:51 +02:00
Emmanuel Lepage Vallée f1335be21a
Merge pull request #2855 from Elv13/screen_geo_template
doc: Add some images to represent the various area of a screen.
2019-08-25 15:48:18 -04:00
Aire-One d97dccfa1f doc: Improve the screen padding image.
It now shows the padding instead of the tiling area.
2019-08-25 15:35:17 -04:00
Emmanuel Lepage Vallee 602d6ded07 doc: Add some images to represent the various area of a screen. 2019-08-19 01:48:00 -04:00
Emmanuel Lepage Vallee f0bf0df6f0 doc: Add an UML class diagram like table of cardinalities.
It will help users find how to get some objects from other objects.
2019-08-19 01:19:32 -04:00
Emmanuel Lepage Vallee c48b03ca9c doc: Help the examples with text but no images get generated more often.
In case of error, well, make an error, but update the content anyway.
This will be enough for the CI but makes development less painful.

Also update the cmake targets to re-generate them more often.
2019-08-19 00:24:14 -04:00
Emmanuel Lepage Vallee 6cb54db6c1 tests: Fix tag:clients() in the shims 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee 84a0ca56a2 tests: Implement dynamic properties for the client shims.
This way enough signal are sent to display clients modified by the
rules.
2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee 9283719bfb tests: Implement the fake_* screen methods 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee f0b6e36ac1 tests: Implement mouse.screen properly 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee e8c1463ce3 tests: Compute root.size() cxorrectly 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee 4eda67ce54 tests: Add the struts to the shims 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee 44e6b2d24e shims: Always return something for c:tags() 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee 48f973f2eb tests: Add awesome.xrdb_get_value to the shims 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee ef508462b8 shims: Add a better error message when mouse.screen is called too early. 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee d3a0dcffcd tests: Add client:kill() to the shims. 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee a18348542c shims: Enforce working on valid screen objects.
Previously it was possible to manipulate deleted screens and that
made debugging harder down the line. By catching this early, it
wont be as nightmarish.
2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee ce2dbea510 shims: Avoid a race condition when setting the mouse screen. 2019-08-18 02:44:34 -04:00
Emmanuel Lepage Vallee f7c0f419e9 shims: Fix indentation 2019-08-14 00:55:27 -04:00
Emmanuel Lepage Vallee 1617c894cc tests: Use rawget to avoid trigerring the tripwire.
The next commit will introduce extra checks that would otherwise
break this.
2019-08-14 00:55:27 -04:00
Emmanuel Lepage Vallée 1e59fc7fd2
Merge pull request #2828 from Elv13/matcher_v2
Improve `gears.matcher` to be more flexible.
2019-08-11 22:29:35 -07:00
Emmanuel Lepage Vallée ed0918385c
Merge pull request #2825 from Elv13/yet_more_notif_fixes
Support the notification spec v1.2
2019-08-10 12:47:09 -07:00
Emmanuel Lepage Vallée c4c97174e6
doc: Fix a rendering regression regarding backgrounds. (#2820)
The way background are rendered changed to accomodate issues regarding
cliping and border. However this broke the documentation examples.

This commit fixes this in the least hacky way I found.

Fixes #2727
2019-08-06 22:48:06 -07:00
Emmanuel Lepage Vallee 91ca922671 tests: Test the gears.matcher greater and lesser sections. 2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 2dc8c62b9b tests: Test gears.matcher "rule_every". 2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 774465df4d doc: Add the new grears.matcher features to the lone example.
This isn't really intended to be used outside of the object rules.
2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 6d58d7b4a2 tests: Test that the legacy naughty popup is used when the new API fails
Displaying errors is important. If the notification popup caused the
error, it was likely nothing could be displayed.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 529f4be53e tests: Check that naughty emits "request::display_error" when needed. 2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee aed2af44b6 tests: Check if using client icon doesn't exceed the size constraints. 2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 6761778830 tests: Test the notification icon theme request::icon support. 2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 4fe05a566d tests: Test exposing the notification persistence and animation props 2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 7d609fb69b tests: Test the notification spec v1.2 "resident notification" support.
If a notification is resident, invoking an action should not destroy it.
If an action is not resident, invoking an action destroys it.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee e076bc664e naughty: Bump the SPEC version compliance to v1.2.
* action icons
 * persistence
 * residence
 * categories
 * animated icons
 * more ways to get icons

In addition, the commit also tries its best to attach notifications to
objects using various dubious semi compliant hints or the DBus PID. It
works often enough to be useful.
2019-08-03 01:45:22 -04:00
Sergey Vlasov f08599a6d6 test-leak-client.lua: Test GC for titlebar widgets (#2830)
Add a test which recreates the titlebar for an existing client and
checks that widgets from the old titlebar instance can be GC'd.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-22 17:35:18 +03:00
Emmanuel Lepage Vallée f3ee880bd8
Merge pull request #2816 from Elv13/more_notif_fix
Fix 4 "new API" notification bugs
2019-07-10 17:27:27 -04:00
Emmanuel Lepage Vallee aabbb412fe naughty.action: Fix icon_only.
It could not be specified in the contructor.

Fix #2815
2019-07-07 16:07:37 -04:00
Sergey Vlasov 51e823832c test-awful-placement: Test no_overlap with unselected tags (#2809)
Test the behavior of awful.placement.no_overlap when placing clients on
unselected tags.  Currently this tests only the most common case with
only a single selected tag and a single tag set for each client.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:43:30 +03:00
Sergey Vlasov c48d2e5a70 test-awful-placement: s/window/client/g
Use the "client" term consistently instead of using "client" in code and
"window" in comments.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov ec8edaf9d5 test-awful-placement: Test no_overlap with sticky clients
Clients which are sticky should be taken into account by
awful.placement.no_overlap even if they seem to be on a different tag;
add a test to verify this behavior.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov b6c7e6751a test-awful-placement: Test no_overlap with hidden and minimized clients
Clients which are hidden or minimized should be ignored by
awful.placement.no_overlap; add a test to verify this behavior.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov 1c27f9d227 test-awful-placement: Reindent after the previous change
Only whitespace changes and reformatting of comments.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov 9e894d8fdd test-awful-placement: Make the test repeatable
In order to test the behavior of awful.placement.no_overlap with
unselected tags, the test sequence must be able to run multiple times.
Fix the test code to make this possible (currently it just performs the
same sequence 3 times, the code to actually test the behavior with
different tags will be added later).

Indentation is unchanged to make the changes obvious in diff; the next
commit will contain formatting changes without anything else.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:05 +03:00
Uli Schlachter fe37eeb913 Fix index handling in a taglist example (#2810) 2019-07-03 16:54:42 -04:00
Emmanuel Lepage Vallee c97cb5c282 tests: Test the new naughty.widgets
This commit also add some "magic" comments to existing tests so they
render correctly. Note that some older commits predates these "magic"
comments, which is why they are not there.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee b4ece0f053 doc: Use an explicit tag for all static functions.
This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.

This commit also fixes a large number of issues found while
proof-reading everything.
2019-06-08 18:14:13 -04:00
Michael Beaumont 9e2a544ba3 naughty: Add position "middle" to center notifications in screen (#2775)
Signed-off-by: Michael Beaumont <mjboamail@gmail.com>
2019-06-08 16:10:14 -04:00
worron 5fef354892 Fix instance existing check for application spawn (#2774)
User defined matcher now has higher priority while checking
existing instance for application spawn.
2019-06-08 16:09:37 -04:00
Hùng 755c44ca52 Slider new feature `bar_active_color` and examples
- Fill slider bar with a linear pattern based on current value (if `bar_active_color` and `bar_color` are correctly provided)
- Add examples for the apidoc
2019-04-23 23:13:32 -04:00
zsugabubus 7c54e1cbf2 tests/examples: Fix minor typo in vimode.lua (#2755) 2019-04-23 23:12:20 -04:00
Emmanuel Lepage Vallée df0cdbed61
Merge pull request #2600 from Elv13/extract_rules
Extract the awful.rules logic into a gears module
2019-04-15 13:28:48 -04:00
Emmanuel Lepage Vallée 63e7c68b6c
Fix the broken test due to the "soft" merge conflict of two notification pull requests. (#2751)
* naughty.legacy: Fix a regression caused by a prior fix.

The title was only set "later" because it was called too early.

The intended result was to prevent the code from being executed when
there is no leagcy popup, but it had this side effect.

* naughty.dbus: Expose the new "private" methods so they can be tested.

Because it now uses Gio instead of capi.dbus, it isn't possible to
just shim the backend anymore.

* shims: Upgrade the dbus shims to also emulate some Gio behavior.

As usual, it is the most basic version that produces the correct
result. It doesn't try to comply to the real API.
2019-04-15 13:07:53 -04:00
Uli Schlachter 8218c30a84 Improve the error message for the current breakage (#2749)
The tests for naughty are currently broken, because naughty.dbus now
uses Gio for interacting with DBus, but the tests still try to use
awesome's dbus object. Turn the resulting weird error into something a
lot less cryptic.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-04-14 13:44:05 -04:00
Emmanuel Lepage Vallée dc1f87ef84
Merge pull request #2738 from Elv13/doc_tests_and_notif_p5_1
Split the reviewed groundwork commits from the notification widgets pull request
2019-04-13 12:57:58 -04:00
Alphonse Mariya 1a0c0fb2e2
keygrabber: Add test for multiple instance creation (#2712) 2019-04-08 11:21:43 +02:00
Emmanuel Lepage Vallee a081413339 tasklist: Auto-call set_client on all template widgets
This commit also update one of the example to remove its now
redundant boilerplate code.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee d5a06b0c68 tests: Share the "default look&feel" boilerplate code among the tests.
This will avoid some copy/paste in future tests.

The commit also fixes a typo and a missing --DOC_NO_DASH which breaks
rendering with one of the markdown implementation.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee fe10119933 tests: Test the notifications. 2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 441c4ae98c tests: Add a notification template. 2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee eb1c45b656 background: Update all users so they don't use the deprecated name.
This is done before deprecating the API so no commit ever use the
deprecated name.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 59e2ae6800 shims: Set capi.screen.primary.
This is used as a fallback when some objects go out of screen.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 0c53d76f25 shims: Emit property::geometry when resizing screens.
It allows to wibars to be resized.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 6aabb73fa3 shims: Implement signal forwarding.
This make the rules, among other things, work.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee be72b4033a shims: Prevent a potential stack overflow in the client shims. 2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 8111495c88 shims: Set the client metatable earlier.
Once the signals get propagated, it means "manage" will call code before
the metatable is set. If this happens and it sets some properties, they
will perpetually bypass the `awful.client.object` handler.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 936040a283 shims: Add disconnect_signal.
It is necessary when adding many wibars.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 7997549067 shims: Do not select all tags by default.
It will now behave closer to the default config.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 68f6a567d1 tests: Prevent a rare-ish race condition in the buttons test suite.
Given there is some async wibox redraw operations, there is a tiny,
tiny chance the test suite callback will be executed before the
redraw. It has been seen on the CI, so it is not 100% impossible.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee dc867ef36d tests: Add an example for gears.matcher 2019-04-05 20:40:53 -04:00
mergify[bot] 795c792d11
Merge pull request #2661 from psychon/selection_global
Change the selection global
2019-03-07 02:59:33 +00:00
Emmanuel Lepage Vallée f7c20b38f1
Merge pull request #2715 from Elv13/notif_replace_id2
Fix 4 issues related to the notification refactoring
2019-03-03 16:43:09 -05:00
Emmanuel Lepage Vallee 0b820b077d tests: Fix the tests then notify-send is not installed.
Fix #2684
2019-03-03 16:24:17 -05:00
Emmanuel Lepage Vallee 4930978424 naighty: Fix to use the same object using `naugthy.notify{replace_id}`
Fix #2678
2019-03-03 16:24:17 -05:00
mergify[bot] 3ff795b4fc
Merge pull request #2716 from psychon/once_optional_rules
awful.spawn: Make rules optional in once / single_instance
2019-03-03 21:20:10 +00:00
Uli Schlachter 244932749b awful.spawn: Make rules optional in once / single_instance
There is not much good reason why this should be required and making it
optional is almost trivial, as this patch shows.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-03-03 08:52:31 +01:00
Emmanuel Lepage Vallee 9954e43521 tests: Use the same string for both notification lines.
Otherwise you cannot compare the width since `r` is thinner than `z`
in some non-monospace fonts.
2019-03-02 12:51:03 -05:00
Uli Schlachter a7f4777272 test-gravity.lua: Turn into a direct test
This commit makes test-gravity.lua use the new infrastructure that was
added in the previous commit: Instead of pretending to be a steps-based
test, this is now a direct test. This gets rid of all the useless
wait_a_bit steps that exist purely to satisfy the steps-based test
runner.

This commit makes test-gravity.lua about one third shorter. Also, the
test might run a tiny bit faster, since there is no more timer that
regularly checks if the test is done, but instead it finishes
immediately when the external process finishes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-28 13:27:23 +01:00
Uli Schlachter f304c608e8 tests/_runner.lua: Allow non-step based tests
The current _runner.lua expects a table containing steps to be passed
in. However, not all tests look like this. This commits adds an API to
the runner that allows tests to run however they like. They just have to
call run_direct() initially and call done() when they are finished.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-28 13:27:23 +01:00
Uli Schlachter ae58192951 Move selection API under the "selection" global
This moves selection_acquire to selection.acquire, selection_getter to
selection.getter and selection_watcher to selection.watcher. The only
user-visible change due to this is that type(selection) is now "table"
instead of "function". If that breaks something for you, tough luck.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-26 22:16:49 +01:00
mergify[bot] 2d2dba0d80
Merge pull request #2643 from psychon/selection_ownership
Add API for setting clipboard contents
2019-02-26 19:57:05 +00:00
Emmanuel Lepage Vallée f049046332
Merge pull request #2696 from alfunx/naughty-legacy-resize-on-update
naughty: Resize notification when setting text
2019-02-24 15:12:35 -05:00
Alphonse Mariya 04c9477f73
test: Test notification resizing on text change 2019-02-24 19:46:25 +01:00
Emmanuel Lepage Vallee e9d44e820d test: Test the notification ids 2019-02-24 12:08:50 -05:00
Emmanuel Lepage Vallee ecec00f425 tests: Disable a test that's invalid 2019-02-22 11:47:46 -05:00
Daniel Hahler 909ef8f532
Merge pull request #2667 from psychon/test_runner_timeout
tests/_runner: Don't lower timeouts for later steps
2019-02-19 20:44:55 +01:00
mergify[bot] 5908d9e108
Merge pull request #2683 from psychon/naughty_test_gio_dbus2
test-naughty-legacy: Use GDBus instead of spawning dbus-send
2019-02-19 18:47:07 +00:00
Uli Schlachter 828ce1471e test-naughty-legacy: Use GDBus instead of spawning dbus-send
This is inspired to be a correctness fix: The "hints" argument to
notifications is supposed to have type a{sv}, i.e. this maps from string
keys to some generic value. dbus-send does not support this and instead
it sends an argument of type a{ss}, i.e. a mapping from string to
string. This commit fixes this problem and uses the correct type.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-19 18:35:09 +01:00
Daniel Hahler ddf422dd0d
cmake: fix generate-examples/check-examples (#2545) 2019-02-19 00:15:19 +01:00
Uli Schlachter d1f15f9839 tests/_runner: Don't lower timeouts for later steps
The first step of a test is called 20 times before a failure is
diagnosed. Later steps only get five calls to finish. I guess the idea
is that the first step sets everything up and opens all necessary
clients, while later steps then do something with these clients.

However, looking at our existing tests, they are not structured like
that. Later steps open more clients etc.

Since this limit has no negative impact on the run-time of tests, but
only means that failures are detected later, let's just remove this
limit of five calls.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 08:51:10 +01:00
Uli Schlachter 0ce668857e test-selection-transfer: Explain need for wait_a_bit
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 07:16:16 +01:00
mergify[bot] e7a67d300e
Merge pull request #2664 from psychon/naughty_test_print_warning
Some changes to the new naughty test
2019-02-18 01:33:14 +00:00
mergify[bot] fd38e2fb5c
Merge pull request #2658 from psychon/delayed_call_run_now
Add and use gears.timer.run_delayed_calls_now()
2019-02-17 19:25:04 +00:00
Uli Schlachter a54eb67de0 naughty test: Use array-style spawn() calls
When a string is spawned, the C code has to split this into an array for
the execve() syscall. When an array is given directly, this array does
not need to be transformed in any way. This makes it much more clear
what is actually started.

This commit removes some quotation marks that were previously removed by
the C code. For example,

    array:string:1,"four",2,"five",3,"six"

became

    array:string:1,four,2,five,3,six

because otherwise the action was called "four" instead of four and the
test failed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 10:30:31 +01:00
Uli Schlachter 083462e0c1 naughty test: Warn about missing dependencies
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 10:21:18 +01:00
Uli Schlachter 01bd2d1896 selection_acquire: Change the API to a table
As requested in the review, instead of just having a single string
argument, selection_acquire() now has a table as its argument. It
searches the string under the "selection" key here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 08:00:57 +01:00
Emmanuel Lepage Vallee 1b4c1e9f1c tests: Test the naughty deprecated APIs 2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee db591b50a4 tests: Add extensive tests for the existing notification features.
This new test suit add a rather extensive coverage to the "legacy"
notification popups. A few minor bugs have been found and fixed
and we can rest assured that the new spec 1.2 support and extended
manipulation API wont regress existing configs.
2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee 1b567cc06a notification: Rename text to message
There is many "text" and the default text is the title, not the body.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee 9df77e5c76 naughty: Move the notification object into its own file.
Mostly for the documentation, but also as the new base upon which
to build the modular notification GUI.
2019-02-16 15:25:10 -05:00
Uli Schlachter 8fdc89ff09 Add and use gears.timer.run_delayed_calls_now()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-15 17:04:19 +01:00
Uli Schlachter fa39de17b3 Add a test for selection ownership and transfer
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
mergify[bot] ec47abb4bc
Merge pull request #2639 from psychon/selection_get
Add selection getter objects
2019-02-11 04:00:59 +00:00
Uli Schlachter 4c82199d19 selection_getter: Convert to use a table as argument
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-10 09:49:11 +01:00
Uli Schlachter cc73c39a60 Add a test case for the selection getter
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 17:59:36 +01:00
Uli Schlachter 75e67e1d33 Fix Luacheck warnings
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 14:31:57 +01:00
Uli Schlachter 83ffc2b0ce Add a test case for the selection watcher
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 14:31:57 +01:00
Uli Schlachter b5abd53cbf Use reproducible timestamps in more doc examples (#2626)
This adds require("_date") to some example tests that use the current
date via os.date. This allows reproducibility by replacing os.date()
with a function that uses a static date from $SOURCE_DATE_EPOCH. See
commit 9d7eaf0 for more details.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-29 19:36:40 +01:00
mergify[bot] cdd6e360f5
Merge pull request #2609 from psychon/shape_outside
Change the way the shape is done in the background container
2019-01-29 18:21:24 +00:00
Uli Schlachter 84eb175ccd background container: Deprecate shape_clip property
The previous commit removed the implementation of this property.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-28 14:55:53 +01:00
Emmanuel Lepage Vallee 4524a7880d tests: Test the layoutlist 2019-01-26 01:34:59 -05:00
Emmanuel Lepage Vallée 7e7733c6d1
Merge pull request #2521 from Elv13/modifiers
awesome: Add a `modifiers` field.
2019-01-24 23:59:54 -05:00
Emmanuel Lepage Vallee 6c1f9ec651 tests: Test the awful.popup 2019-01-24 10:58:45 -05:00
Emmanuel Lepage Vallee 94937595c2 doc: Use the modifier name instead of the keysym for the alttab example 2019-01-21 03:14:26 -05:00
Emmanuel Lepage Vallee b466db955f shims: Add awesome._modifiers 2019-01-21 03:13:26 -05:00
Emmanuel Lepage Vallee 5ab547fbfd tests: Test the awesome.modifiers 2019-01-21 01:08:48 -05:00
Daniel Hahler d2fd15cf99
cmake: pass DO_COVERAGE=1 in env for tests/run.sh (#2575)
`$DO_COVERAGE` is used in tests/run.sh, and should be set with the
`DO_COVERAGE` CMake option.
2019-01-11 17:04:23 +01:00
Daniel Hahler 5dbb5b4992 tests/run.sh: fix handling of test args
Fixes `tests/run.sh tests/test-signal.lua`.
2019-01-03 13:54:37 +01:00
Emmanuel Lepage Vallee 89867386c5 tests: Add images to the tooltip documentation
It also add some properties such as `border_width`, `border_color`
and `preferred_alignments`.

It also fix a documentation bug where the `margin_topleft` was called
`margins_topleft`. To conform to the documentation, both are now valid
but one should be removed the next time the API changes.

Fixes #1978
2018-12-24 21:52:30 -05:00
Emmanuel Lepage Vallee d8a7782bf4 tests: Add an awful.placement.next_to test
It was overdue
2018-12-24 21:52:30 -05:00
Emmanuel Lepage Vallee c3302c4bbe tests: Improve the awful example template
* Support async operations
 * Support `awful.popup`
 * Support minimized clients
2018-12-24 21:49:52 -05:00
Emmanuel Lepage Vallee 90342b62c6 shims: Make sure the wibox boolean properties are set
Also make some changes to support tooltips.
2018-12-24 21:49:52 -05:00
Sergey Vlasov d17433f6c9 tests: Add test for Motif titlebar hints
Test the c.requests_no_titlebar and titlebars_enabled=function...
features.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2018-11-12 11:48:59 +03:00
Emmanuel Lepage Vallée 2458f127f3
Merge pull request #2360 from Elv13/add_awful_tag_layouts
awful.tag: Add awful tag layouts
2018-10-22 14:40:16 -04:00
Emmanuel Lepage Vallee fded6acf97 tests: Fix a race condition in the spawn test.
To happen, both of these races have to be lost by client3

 * client2 have to take more time to `:kill()` than client3 take
   to be spawned.
 * client4 have to start faster than client3

It is very unlikely to happen on normal systems, but on server it
happens. Some factor that may or may not be involved

 * The scheduler assigned client2 on a very busy CPU and client 3
   on a CPU still busy while some other CPUs are idle
 * Linux is bad at scheduling hyper-threading
 * The system is NUMA and the memory bandwidth is lacking on a core
 * There is some "Z" memory compression or drive based swap
 * Extreme bad luck

Fix #2424
2018-10-16 12:35:18 -04:00
Emmanuel Lepage Vallée 35130169c9
keygrabber: Rename release_event to stop_event (#2422)
In the earlier revision of the keygrabber PR, there was a `release_key`
and it was suggested to rename it `stop_key`. However its sibling
`release_event` wasn't, so it is now confusing.

The commit adds a mild deprecation codepath to avoid breaking configs
based on git-master. However it isn't a "long term" deprecation notice
and the code can probably be removed in 5.0 without further delay.
2018-10-16 08:42:56 -04:00
Emmanuel Lepage Vallee 23c122e89a tests: Test awful.tag.object.set_layouts 2018-10-15 16:10:18 -04:00
mergify[bot] 7020a9707f
Merge pull request #2421 from Elv13/fix_2419
Fix 2419
2018-10-08 16:46:46 +00:00
Emmanuel Lepage Vallee 6229783e16 tests: Add a titlebar integration suite
It doesn't do all that much, but will prevent #2419 from regressing
2018-10-06 18:57:27 -04:00
Emmanuel Lepage Vallee 4c7bcf044c tests: Add more spawn tests 2018-10-05 10:57:55 -04:00
Emmanuel Lepage Vallee 0ac99a5dc5 awful.rules: Rename switchtotag to switch_to_tags.
First of all, it select many tags, so there is an "s". Also, Awesome
standardised naming to snake case in v4.0, but this was missed.
2018-10-04 09:16:00 -04:00
Sergey Vlasov 16b5803fda Add a test for awful.placement.no_overlap+awful.placement.no_offscreen
Test that the placement function used in the default configuration
behaves as intended.  This test was failing before the no_overlap and
no_offscreen fixes in two previous commits.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2018-09-13 08:23:36 +03:00
Sergey Vlasov 61cdc40595 awful.placement: Fix no_offscreen when composed with other functions
The awful.placement.no_offscreen function did not work properly when
composed with other placement functions; in particular, the default
configuration (awful.placement.no_overlap+awful.placement.no_offscreen)
was broken.  The compose function sets args.pretend=true and puts the
result of the previous placement function into args.override_geometry
before calling the next placement function, but no_offscreen did not use
args.override_geometry, therefore the result of the previous placement
function was discarded.

All other placement functions use `geometry_common(c, args)` to get the
current client geometry; `area_common(c)` should be used only when
getting geometry of other clients.

This change also fixes the problem with margin handling (adding margins
should not affect the window size, only the window position should
change); the test output which was adjusted in commit 0275d3537d
is adjusted again to account for this change.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2018-09-13 08:23:36 +03:00
Sergey Vlasov 7f11bc1108 tests: Add initial size support to the test client
Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2018-09-12 08:20:53 +03:00
Sergey Vlasov 0e3979b8e4 tests: Fix resize width/height mixup in the test client
Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2018-09-12 08:15:38 +03:00
Uli Schlachter 0275d3537d Fix no_offscreen test
Commit fec8d6aa8f fixes awful.placement.no_offscreen to behave
like other placement functions. This means that the margins=40 argument
that this test used and that was previously was just ignored, now
started working. Thus, there are now 40 pixels less on each side of the
client in this test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-22 13:35:09 +02:00
Uli Schlachter 674cd21b81 Merge branch 'second-try-no-offcreen' of https://github.com/actionless/awesome 2018-08-22 12:26:05 +02:00
Uli Schlachter a996b21ee2 test-gravity.c: Accept different roundings
Some window gravities require a division by two. Up to now,
test-gravity.c expected this division to always be rounded up. This
commit changes the code to also allow rounding down.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-17 11:48:49 +02:00
Uli Schlachter 3aefce7ccb Merge branch 'example_tests_during_build_again' of https://github.com/psychon/awesome 2018-08-08 15:53:32 +02:00
Emmanuel Lepage Vallee a961c5f002 tests: Add keygrabber tests. 2018-08-06 19:03:25 -04:00
Emmanuel Lepage Vallee e05222088a tests: Add fake_input tests 2018-08-06 19:03:25 -04:00
Emmanuel Lepage Vallee 0765772c17 shims: Fix a typo in a root.fake_input name 2018-08-06 18:34:40 -04:00
Emmanuel Lepage Vallee a32d892988 tests: Add ways to input fake strings and keybindings.
This commit add a way for the test to avoid all the boiler-plate code
necessary to perform higher level input emulation.
2018-08-06 18:34:40 -04:00
mergify[bot] 1cb8375261
Merge pull request #2340 from psychon/print_log_on_awesome_client_failures
tests/run.sh: Print log on awesome-client failures
2018-08-06 18:06:47 +00:00
Uli Schlachter 2769bdbc5b tests/examples: Run example-tests in build phase, not configure phase
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 16:50:46 +02:00
Uli Schlachter be728324ef tests/examples: Change ENV handling
Instead of messing with CMake's environment and having that implicitly
inherited when running a process, explicitly set $SOURCE_DIRECTORY where
required.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 16:50:46 +02:00
Uli Schlachter 0e94f8bd6b tests/run.sh: Print log on awesome-client failures
tests/run.sh uses awesome-client to actually make awesome run the test.
If awesome-client fails, then the only error message that is printed look like:

== Running /home/travis/build/awesomeWM/awesome/tests/test-leaks.lua ==
Error org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
E: dbus-send failed.
make[4]: *** [CMakeFiles/check-integration] Error 1

To also get the output from awesome, this commit makes failures from
awesome-client non-fatal so that the following shell code can notice the
failure and hopefully print some useful information.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 16:03:17 +02:00
Emmanuel Lepage Vallée e889caba91
build: Auto-add example tests outputs. (#2339)
This commit allow the file to be auto added when it doesn't exist. This
save the useless process of writing it by hand.
2018-08-06 09:30:59 -04:00
Uli Schlachter 73b519d38b Fix STRICT_TESTS (#2338)
STRICT_TESTS was introduced in commit c22b93963. Some people have setups
where e.g. fontconfig produces warnings. These warnings made the tests
under tests/examples/ fail. The above commit changes things so that
these warnings are ignored by default, unless STRICT_TESTS is enabled.

Commit b5ca8bf937 broke this by making example test failures fatal
again.

Fix this by appending "|| true" to the command to run in case strict
tests are disabled. Thus, all failures from tests/examples/runner.sh get
ignored.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 09:05:51 -04:00
Emmanuel Lepage Vallée dd7161ee0a
build: Fix a regression when adding new example tests. (#2337)
If the example had a text output, it would cause an error

Regression from b5ca8bf93
2018-08-06 09:05:31 -04:00
Uli Schlachter 15a508f022 Merge branch 'examples_tests_during_build' of https://github.com/psychon/awesome 2018-08-03 14:30:25 +02:00
Uli Schlachter 477af1b145 test runner: Move running to a shell script
Instead of running the example tests directly from CMake and checking
the results via CMake, the tests are now run through a shell script.

So far, there are too many variables involved for me to easily figure
out how to run this shell script in the building phase instead of the
configuring phase, but at least this commit moves the "actual running"
out of CMake, bringing us a step closer to that goal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-31 17:50:41 +02:00
Emmanuel Lepage Vallee 6240ec113f tests: Implement keybindings, keygrabber and fake_inputs 2018-07-29 10:46:27 -04:00
Emmanuel Lepage Vallee 3adad38c0a tests: Make the capi.screen shim more robust
Also add some private properties to be consumed by the template for a
better rendered documentation example image.
2018-07-29 10:46:27 -04:00
Emmanuel Lepage Vallee 2c8c274193 tests: Add the capi.object miss handle support to the capi.mouse shim 2018-07-29 10:46:27 -04:00
Emmanuel Lepage Vallee 1df44210c8 tests: Add many missing client properties so the tilebar loads correctly 2018-07-29 10:46:27 -04:00
Emmanuel Lepage Vallee ff9f78ef7e tests: Add the cursor and focus colors to the generated images theme. 2018-07-29 10:46:27 -04:00
Emmanuel Lepage Vallee bf6ab0ba4c tests: Mock the keyboard layout API enough to stop getting errors.
It IS NOT correct, the point is to be able to load the keyboard widget
with errors.
2018-07-29 10:46:24 -04:00
Emmanuel Lepage Vallee f1245f083c tests: Add a basic `key` shim 2018-07-29 10:45:40 -04:00
Uli Schlachter b5ca8bf937 example tests: Save expected test output in a txt file
This commit adds a .txt file next to each example test that generates a
text output. This text file contains the expected output and it is an
error if the actual output does not match the expected output. This
means that we no longer have to run the example tests before we can
expand all the @foo@ expressions that occur.

While touching this, I also fixed some typos and unexpected newlines in
the tests' output.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-27 08:56:18 +02:00
mergify[bot] e7251011ac
Merge pull request #2314 from Elv13/add_example_generator_options
Add example generator options
2018-07-25 07:15:18 +00:00
Emmanuel Lepage Vallee 4e8d907044 tests: Restore support for newlines in examples
Since last year luacheck change, trailing spaces are no longer
allowed. This caused all documentaiton examples that used them
as a way to mark newlines to look plain wrong.

This commit add an explicit flag to make longer examples more
readable.
2018-07-24 17:22:41 -04:00
Emmanuel Lepage Vallee c340c14cf2 tests: Improve the CMakeLists.txt
* Add a FOLLOW_SYMLINKS so Awesome 3rd party module can share the
  awesome test infrastructure by adding themselves as symlinks in
  `lib/`, `tests/` and `tests/examples` and otherwise use AwesomeWM
  Travis config.

* Add an option to add examples to the C documentation. Previously only
  Lua functions could be documented using this framework.
2018-07-24 17:22:41 -04:00
Uli Schlachter e1a90ecf5b tests/examples: Explicitly mark tests generating text
This is similar to the previous commit, but for text output that is
produced by some test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-24 14:27:41 +02:00
Uli Schlachter 654eecd40d tests/examples: Explicitly mark tests generating an image
This allows to figure out if a test will generate an image without
having to run it. The long term plan for this is to run the tests during
compiling ("make") and not during configuring ("cmake"). Since the list
of files to e.g. install needs to be known during configuring, this
commit is a necessary step in that direction.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-24 14:12:44 +02:00
Uli Schlachter efe23dc7d2 tests/examples: Drop support for PNG output images
No currently existing test produces a PNG image, so why do we even check
for such an output file?

I did 'rm -rf build && make -j9 && cp -r build /tmp', then applied this
patch, and then did another 'rm -rf build && make -j9'. According to
diff, the resulting directories are basically the same (except for lots
of timestamps and some non-determinism in CMake).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-24 13:49:43 +02:00