Commit Graph

145 Commits

Author SHA1 Message Date
mergify[bot] 7a8fa9d27a
Merge pull request #3294 from sclu1034/feature/count_keys
Add utility to count table keys
2021-04-01 07:42:25 +00:00
Emmanuel Lepage Vallée 13e8408562
Merge pull request #3284 from sclu1034/issue/3213
Fix composite widgets with top level container
2021-03-28 16:00:16 -07:00
Lucas Schwiderski 058190a3c0
Add missing modelines
Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-03-22 20:24:56 +01:00
Lucas Schwiderski 07df24f7d0
Add utility to count table keys
See #3293.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-03-22 20:24:55 +01:00
Daniel Hahler dab84c2662
fix(doc): gears.table.keys: s/integer keys/integer/ (#3293) 2021-03-22 12:05:17 -07:00
Lucas Schwiderski 5fb6109439
Fix shadowing value in slider unit test
Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-03-22 09:26:43 +01:00
Lucas Schwiderski 504bf53b8c
Add unit test for wrapping a margin container
This adds a test case where a `wibox.container.margin` with a
`wibox.widget.imagebox` as child is wrapped by a simple function call.

Check against regression in #3213.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-03-22 09:21:23 +01:00
Lucas Schwiderski bed737a29f
Add tests for widget constructors
Adds unit tests for the widget constructors that used to accept an
unused argument.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-03-08 20:09:58 +01:00
Grumph 4e36cf862f Add tests 2021-01-27 01:41:56 +01:00
actionless fa494a1e18 test(spec: gears: matcher): spec _match() for string typ 2020-04-22 01:40:00 +02:00
handsome0hell e5b12877b9 use user specified permission.
User settings should override default behavior.
2020-03-08 05:04:40 -04:00
Emmanuel Lepage Vallee 115a151ac1 tests: Add the awesome.api_level to the widget utils. 2020-02-29 19:47:36 -05:00
mergify[bot] 81d6521149
Merge pull request #2992 from SethBarberee/placement_spec
add test spec for placement
2020-02-16 17:57:54 +00:00
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
Uli Schlachter 225bb8a8c6 Consider icon spacing in systray:draw()
When less space is available than was asked, systray:draw() has to
compute the right base size so that all the icons fit into the available
space. This computation so far ignored the icon spacing, resulting in a
too large base size.

Fixes: https://github.com/awesomeWM/awesome/issues/2981
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-02-13 12:11:41 -05:00
Uli Schlachter 60033a2113 Start some unit tests for the systray icon
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-02-13 12:11:41 -05:00
Seth Barberee 2c919ed936 add test spec for placement 2020-02-13 00:26:01 -06:00
Emmanuel Lepage Vallee 523e7dc6ba tests: Test gears.geometry.rectangle.is_inside. 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 9cbc8a18c0 rc.lua: Revert moving the sloppy focus to awful.permissions.
This caused a behavior change it wasn't clear how to use the
permission API to change the focus mode.

The change will only take effect if the user override the API
level.
2020-02-08 17:59:16 -05:00
Emmanuel Lepage Vallee 8a877bd429 tests: Mock `drawin` in the permission unit tests. 2020-02-02 21:06:00 -05:00
Yauhen Kirylau 37aa23be86 fix(gears: string: split): support more delimiters (#2962) 2020-01-19 19:04:28 -05: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 efc42b1be1 autofocus: Modify `awful.autofocus` to be a request::.
This also pulls in part of the permission framework to ensure
backward compatibility is kept.

`awful.autofocus` was always weird. It is a module part of `awful`,
but it was never part of `awful` `init.lua`. Rather, `rc.lua` was
the sole place it was used. It behave exactly like a request, but
predate them by years. As I cleanup the request:: API before the
permissions API gets formalized, this has to be fixed now.

It isn't deprecated in this commit because it makes too many tests
fail. Another pull request will solve that by adding the "API level"
concept to AwesomeWM so I can change the behavior without breaking
existing configs. With that, the behavior of `autofocus` will be
enabled by default with the permissions to disable it.
2020-01-11 15:43:15 -08:00
Seth Barberee 9e3c418a03 add gears.table.cycle_value (#2942) 2019-12-12 22:10:10 -08:00
Emmanuel Lepage Vallee a8dcd3b2a2 tests: Add capi.client to the prompt unit tests.
It will be needed later.
2019-12-04 01:40:32 -05:00
Seth Barberee 5d499db3d0 add tests for find_keys and hasitem 2019-11-25 14:09:29 -06:00
Emmanuel Lepage Vallee 86d8ef3142 awful.button: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 21ae9c1edb awful.key: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 8ffafe4690 tests: Test gears.geometry.rectangle.are_equal. 2019-09-04 13:11:54 -04:00
Emmanuel Lepage Vallee 260078bf3c tests: Add capi.screen.connect_signal to the spec 2019-04-15 15:20:38 -04:00
Sorky 4831a46590 Add get_random_file_from_dir to gears.filesystem
Ref #2596
2019-02-16 13:58:24 -05:00
Sorky 3f26624160 Aligning 'regex' with other PR / Minor readability improvements
https://github.com/awesomeWM/awesome/issues/2596

Re-matched regex used elsewhere & updated test cases for "." in filename

Allowed for alternative extensions to be found even if specified

Reverted the change of behaviour but adjusted code for readability

Small readability change

Avoided delay searches that would never work

Untabify

Reverted possible [unlikely/undesired] behaviour changes

Untabify
2019-02-09 19:21:46 +11:00
Uli Schlachter 4c53f9cbc6 spec/beautiful: Don't print noise (#2612)
This gets rid of the following output when running the unit tests:

2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got an empty table
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got an empty table from: ./spec/beautiful/tests/Bad_1.lua
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a function from: ./spec/beautiful/tests/Bad_2.lua
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a number from: ./spec/beautiful/tests/Bad_3.lua
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a nil from: ./spec/beautiful/tests/Bad_4.lua
2019-01-26 18:31:44 E: awesome: Error during a protected call: ./spec/beautiful/tests/Bad_5.lua:2: attempt to index local 'var' (a nil value)
stack traceback:
	./spec/beautiful/tests/Bad_5.lua:2: in main chunk
	[C]: in function 'dofile'
	[C]: in function 'xpcall'
	lib/gears/protected_call.lua:36: in function <lib/gears/protected_call.lua:35>
	(...tail calls...)
	lib/beautiful/init.lua:224: in function 'init'
	spec/beautiful/init_spec.lua:56: in function <spec/beautiful/init_spec.lua:25>
	[C]: in function 'xpcall'
	/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
	/usr/share/lua/5.2/busted/init.lua:40: in function 'executor'
	...
	/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
	/usr/share/lua/5.2/busted/block.lua:155: in function 'execute'
	/usr/share/lua/5.2/busted/init.lua:7: in function 'executor'
	/usr/share/lua/5.2/busted/core.lua:312: in function </usr/share/lua/5.2/busted/core.lua:312>
	[C]: in function 'xpcall'
	/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
	/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
	/usr/share/lua/5.2/busted/execute.lua:58: in function 'execute'
	/usr/share/lua/5.2/busted/runner.lua:174: in function </usr/share/lua/5.2/busted/runner.lua:11>
	/usr/bin/busted:3: in main chunk
	[C]: in ?
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a nil from: ./spec/beautiful/tests/Bad_5.lua
2019-01-26 18:31:44 E: awesome: Error during a protected call: cannot open ./spec/beautiful/tests/NO_FILE: No such file or directory
stack traceback:
	[C]: in function 'dofile'
	[C]: in function 'xpcall'
	lib/gears/protected_call.lua:36: in function <lib/gears/protected_call.lua:35>
	(...tail calls...)
	lib/beautiful/init.lua:224: in function 'init'
	spec/beautiful/init_spec.lua:57: in function <spec/beautiful/init_spec.lua:25>
	[C]: in function 'xpcall'
	/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
	/usr/share/lua/5.2/busted/init.lua:40: in function 'executor'
	/usr/share/lua/5.2/busted/core.lua:312: in function </usr/share/lua/5.2/busted/core.lua:312>
	...
	/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
	/usr/share/lua/5.2/busted/block.lua:155: in function 'execute'
	/usr/share/lua/5.2/busted/init.lua:7: in function 'executor'
	/usr/share/lua/5.2/busted/core.lua:312: in function </usr/share/lua/5.2/busted/core.lua:312>
	[C]: in function 'xpcall'
	/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
	/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
	/usr/share/lua/5.2/busted/execute.lua:58: in function 'execute'
	/usr/share/lua/5.2/busted/runner.lua:174: in function </usr/share/lua/5.2/busted/runner.lua:11>
	/usr/bin/busted:3: in main chunk
	[C]: in ?
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a nil from: ./spec/beautiful/tests/NO_FILE

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-26 12:54:31 -05:00
mergify[bot] e8bf75ef3c
Merge pull request #2592 from Sorky/patch-1
beautiful.init: Fix return values and improve doco. fixes: #2588
2019-01-25 15:41:15 +00:00
Sorky 366be2105a beautiful.init: Fix return values and improve doco. fixes: #2588 #2592
squashing updates from review by blueyed

Added busted tests

Fixed test files EOF

Remove Travis warning
2019-01-25 22:56:41 +11:00
Sorky f31fbe1220
menubar.utils.lua - remove "function is_format_supported" by making i… #2601
Removing an end of comment block that got left in by accident
2019-01-24 19:46:56 +11:00
Sorky 9927b7a88d squash 2019-01-21 21:37:45 +11:00
Daniel Hahler a732301306 tests: add basic tests for gears.string.split 2019-01-03 18:33:34 +01:00
Uli Schlachter 55639547a2 menubar.utils: Remove some (basically) dead code
This removes unused public functions from menubar.utils. This is not an
API break, because these functions were only added in commit
8d34201ec3, which is after v4.2. These new functions became
unused in commit e88f1e8735, not long after they were added.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-11-07 13:23:25 +01:00
Uli Schlachter c80bf6f46e wibox.layout.flex: Do not leave empty space behind
It is not possible to distribute 100px to three widgets equally. The
current version of wibox.layout.flex tries to do that anyway, by giving
each widget 33px and leaving one pixel outside of any widget. Thus, if
the widgets e.g. have a common background, this leads to a one pixel gap
in the background.

This patch changes the flex layout so that the extra pixel is assigned
to some widget instead. It does so by basically keeping a sum of
space_per_item for the widgets that was assigned so far. This sum is
rounded and when this leads to rounding, the corresponding child widget
gets an extra pixel.

More precisely, this tracks a pos as before. Widgets get their position
still assigned based on rounding pos. However, this now also remembers
this rounded position for the next iteration of the loop. This allows to
assign the size of widgets based on the difference between the current
and last rounded position.

(Possibly) fixes: https://github.com/awesomeWM/awesome/issues/2461
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-11-05 10:13:18 +01:00
Uli Schlachter 4744a744f0 gears.table.join: Ignore nil arguments (#2440)
When calling join with e.g. arguments (nil, {"a"}), then everything past
the nil was ignored, because the code internally used ipairs() to
iterate over the arguments and this stops at the first nil it
encounters.

Fix this by using select() to iterate over the arguments.

This also adds a unit test for this problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-16 10:17:45 -04:00
Emmanuel Lepage Vallee 980c47d775 tests: Mock capi.keygrabger
It will now run "static code" when the module is loaded, so need
to exist.
2018-07-29 10:45:40 -04:00
Aire-One c58e7d4fc8 add busted tests for signal "property::value" 2018-04-24 00:24:06 +02:00
Emmanuel Lepage Vallee 20db37f892 tests: Test the gears.sort module 2018-03-04 01:34:33 -05:00
get 5b882f3b2e Add unit tests for #2152
Adds unit tests for menubar.utils.lookup_icon_uncached.

Tests that icons and themes are found in the icon base directories, and
icons are resolved with the correct priority.

Creates directories and symlinks in spec/menubar/{home,usr} as test
data.
2018-01-15 23:47:20 +01:00
Uli Schlachter 8cc469322f ensure_pango_color: Support hex values with alpha
Reference: https://github.com/awesomeWM/awesome/pull/2129#discussion_r155397507
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-13 02:15:30 +01:00
Uli Schlachter 9b6cea5a13 Add unit tests for gears.color.ensure_pango_color
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-13 02:15:30 +01:00
Daniel Hahler 678ead2634 Add client.object.immobilized_{horizontal,vertical} (#2066)
ewmh.client_geometry_requests: ignore immobilized clients

Fixes https://github.com/awesomeWM/awesome/issues/1676.
Fixes https://github.com/awesomeWM/awesome/issues/2036.
2017-10-25 15:36:00 +02:00
Zach Peltzer 8d34201ec3 Unescape strings when parsing desktop entries (#2043)
* Unescape strings when parsing desktop entries

* Fix unused value warning in menubar/utils.lua

* Move menubar.utils.unescape() tests

* Clean up menubar.utils.unescape() function

* Fix warning for using "_" in a non-local context

* Do not ignore trailing whitespace in menubar.utils.parse_list()
2017-09-28 22:57:39 +02:00