This tests are not-really-good because they are overly specific. They
test for the current behaviour of the implementation, but I guess that a
valid implementation could also behave slightly different. However, for
now this will have to be enough.
Signed-off-by: Uli Schlachter <psychon@znc.in>
* 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
We already have a variant of this function for transforming an actual
matrix. This adds the corresponding static factory.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.
All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This library is a wrapper around pcall() / xpcall() that prints an error message
via gears.debug.print_error() in case of errors.
Signed-off-by: Uli Schlachter <psychon@znc.in>
It's unused since commit 0aa4304bda. Before this was a stable sorting
algorithm since table.sort is allowed to be unstable. Apparently we don't need a
stable sorting algorithm anymore.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Oh hey, Pango exports an API that allows to query for named colors based on the
famous rgb.txt! Let's use that!
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds support to gears.color.parse_color to parse things like "#fff" (one
character per color component, without alpha) and "#ffff0000ffff0000" (four
characters per component, with alpha).
This makes sense on its own, but should also help with
https://github.com/awesomeWM/awesome/issues/585.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds a cyclic dependency between the function used for the weak signal and
an object with a __gc metamethod. The problem occurs since the GC will first
finalize the object (call its __gc metamethod) and only in the next generation
will it actually collect the garbage and remove the functions from weak-tables
using it as a key.
And yes this needs special code for Lua 5.1 because there __gc doesn't work on
tables. :-(
Signed-off-by: Uli Schlachter <psychon@znc.in>
Since weak signals specifically exist to do magic with the garbage collector, do
a couple of garbage collection cycles and verify that this does not disconnect
the callback function prematurely (the function is kept alive since it is a
local variable).
(I actually did a mistake that makes this enhanced test fail and fixed it before
committing)
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of going through LGI to call cairo, this now implements the various
matrix operations directly in Lua. The plan is to avoid the overhead that we hit
due to LGI.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Connecting to a signal weakly has the same effect as connecting to it strongly,
but it allows the garbage collector to disconnect the signal in case nothing
else references this function.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Busted now only provides the magic modules `assert`, `spy` etc for
the busted context. The helper module `spec/wibox/test_utils.lua`
therefore needs to explicitly require them.
Ref: https://github.com/awesomeWM/awesome/pull/139
The previous code assumed that pairs() iterates over the table in a specific
order which is not a safe assumption.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This uses busted (http://olivinelabs.com/busted/) to implement unit testing.
This is wired up to "make check" and/or "make test".
This commit also adds tests for the more complicated parts of the gears and
wibox.layout libraries.
Signed-off-by: Uli Schlachter <psychon@znc.in>