Commit Graph

14 Commits

Author SHA1 Message Date
Uli Schlachter cf1576cdd8 Fix all luacheck warnings in spec/
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:08 +01:00
Uli Schlachter 94e9a030c1 Remove gears.sort
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>
2016-02-07 12:24:35 +01:00
Uli Schlachter 79d3dc003a gears.color: Add support for named colors
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>
2016-01-17 14:27:29 +01:00
Uli Schlachter 0956aa01d9 Add support for short/long colors
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>
2016-01-17 14:16:40 +01:00
Uli Schlachter 0fdecfb2df Add a test case capturing problems with weak_connect_signal (#520)
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>
2015-12-10 23:19:52 +01:00
Uli Schlachter 970a92bb51 spec for gears.object: Test weak signals better
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>
2015-12-10 23:19:52 +01:00
Uli Schlachter 34927b187d gears.matrix: Implement matrices in Lua
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>
2015-09-19 13:32:12 +02:00
Uli Schlachter 16a1ef0f48 Add gears.matrix for working with cairo matrices
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 10:38:22 +02:00
Uli Schlachter 42c913332f Add a generic cache system as gears.cache
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-07-25 15:07:47 +02:00
Uli Schlachter 089ed0e8dd gears.object: Add :weak_connect_signal()
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>
2015-06-25 06:37:04 +02:00
Daniel Hahler c26a96177d spec: fix "require" statements for busted 2.0.rc6
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
2015-02-19 12:13:53 +01:00
Uli Schlachter cf9db056f9 gears.color spec: Don't depend on order of pairs() (FS#1301)
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>
2014-10-15 23:42:24 +02:00
Uli Schlachter 5c387f3bd1 gears.color: Add a way to bypass the pattern cache
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-09-13 14:16:54 +02:00
Uli Schlachter ba50e65b5b Add unit tests
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>
2014-08-23 22:09:06 +02:00