Commit Graph

146 Commits

Author SHA1 Message Date
Jonas Ådahl
9dd3d887d2 Add 'headless start' perf test
This tests that GNOME Shell will launch sucessfully despite there being
no monitors on startup, and successfully hide and then show the
overview, once the monitor is connected.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2623>
2023-02-06 18:10:01 +00:00
Jonas Ådahl
4bcbe9be83 tests: Make perf tests non-parallel
We currently hard code the display name, and running multiple instances
at the same time will probably just make things too slow for CI.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2623>
2023-02-06 18:10:01 +00:00
Jonas Ådahl
dc3ee1a9a2 tests/background-size: Get backend from global
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2557>
2022-12-16 22:12:59 +01:00
Jonas Ådahl
207b9bb3c0 tests: Fail on warnings too
Getting warnings are always bad and means something is broken, we
shouldn't pass the test suite with them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:10:27 +01:00
Jonas Ådahl
f4934c0421 tests/perf: Use custom solid background in tests
They don't measure performance, and we don't want to have to install
gnome-backgrounds, so bundle a solid color background image to use
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:54 +01:00
Jonas Ådahl
bcc4d15fdf tests: Add test running basic perf test
This test runs all of GNOME Shell using the headless backend inside a
mocked D-Bus environment. The basic test tests, well, basic things, like
the panel menu, the overview, showing the app grid view, as well as
going back to the session view.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:53 +01:00
Jonas Ådahl
c628b9f6bc tests: Add dbus runner
This adds a dbus-runner ala meta-dbus-runner.py. It extends the one used
in mutter, and adds various mocked services needed by gnome-shell.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
65a6ceddca tests: Add accounts_service mock service
This is a shrunk copy of the accounts_service.py service previously
found in upstream python-dbusmock. It also adds parental control
properties to make GNOME Shell happy.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Alessandro Bono
b63c6ac0ef cleanup: Use deepUnpack() intead of deep_unpack()
deep_unpack() is just a backwards compability alias for deepUnpack()[1].
The new name makes it more clear that this is not a C function, start to
use it.

[1] 13e662a29d

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
2022-08-10 10:29:24 +00:00
Evan Welsh
a88e59c1a8 Adopt EventEmitter class instead of injecting Signal methods
Introduce a new class, EventEmitter, which implements signal
handling for pure JavaScript classes. EventEmitter still
utilizes GJS' addSignalMethods internally.

EventEmitter allows static typechecking to understand the
structure of event-emitting JS classes and makes creating
child classes simpler.

The name 'EventEmitter' mirrors a common name for this pattern
in Node and in JS libraries.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2043>
2022-07-04 18:30:49 -04:00
Florian Müllner
fc4f9f61fa signalTracker: Explicitly register destroyable types
We currently assume that any '::destroy' signal on a GObject type
has the semantics of the ClutterActor/GtkWidget signal, and should
therefore result in all signals being disconnected.

But we already have a case where the assumption doesn't hold: ShellWM
uses '::destroy' for the closing animation of windows, and the ShellWM
object itself remains very valid after the emission.

So rather than making assumptions about '::destroy', check objects
against a list of destroyable types that are explicitly registered
as such.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2226>
2022-03-06 00:10:03 +00:00
Florian Müllner
cf29ec2f22 signalTracker: Add TransientSignalHolder class
There are cases where we want to connect to a number of signals
for the lifetime of an object, but also other signals for a
limited period (say: between show and hide).

It is currently not possible to use disconnectObject() for the
latter, because it will disconnect all signals.

To address this use case, add a small class that can be used as
a transient signal holder, while still benefiting from autocleanup
by proxying the real owner.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2221>
2022-03-05 00:12:27 +00:00
Florian Müllner
f45ccc9143 signalTracker: Provide monkey-patching for (dis)connectObject()
The module exports a `addObjectSignalMethods()` method that extends
the provided prototype with `connectObject()` and `disconnectObject()`
methods.

In its simplest form, `connectObject()` looks like the regular
`connect()` method, except for an additional parameter:

```js
    this._button.connectObject('clicked',
        () => this._onButtonClicked(), this);
```

The additional object can be used to disconnect all handlers on the
instance that were connected with that object, similar to
`g_signal_handlers_disconnect_by_data()` (which cannot be used
from introspection).

For objects that are subclasses of Clutter.Actor, that will happen
automatically when the actor is destroyed, similar to
`g_signal_connect_object()`.

Finally, `connectObject()` allows to conveniently connect multiple
signals at once, similar to `g_object_connect()`:

```js
    this._toggleButton.connect(
        'clicked', () => this._onClicked(),
        'notify::checked', () => this._onChecked(), this);
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1953>
2022-03-04 14:14:37 +00:00
Florian Müllner
daf729de11 build: Replace deprecated meson functions
Replace deprecated functions with their direct replacements:

 - dep.get_pkgconfig_variable() → dep.get_variable()
 - prg.path() → prg.full_path()
 - source/build_root() → project_source/build_root()

In one case we need meson.global_source_root() that was only
added in meson 0.58, so bump the requirement to that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2077>
2021-12-23 15:52:21 +00:00
Sebastian Keller
a4b6b07d78 tests: Add unit test for highlighter
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2033>
2021-12-22 16:47:18 +00:00
Bastien Nocera
b0a48fad57 util: Add a GNOME version comparison function
Add a function that can compare GNOME versions, including the new naming
scheme for GNOME 40 and later.

Used in https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3632

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1619>
2021-02-05 13:41:26 +00:00
Jonas Dreßler
012af56b37 tests/background-size: Remove ClutterActor::paint signal handler usage
The background-size interactive test includes a test-case which uses the
ClutterActor::paint signal to hijack the painting of the actor. We're
removing that signal from Clutter, so remove that signal handler and
paint the outer border unconditionally to mark the boundaries of the
widget (the outer border actually never worked to force the cairo/cogl
path). To fix the test, change it to not paint a border on the inner
container in the useCairo=false case, which should make sure the cogl
path gets used.

Also remove the useless useCairo argument from addTestLine().

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1479
2020-10-24 23:21:39 +02:00
Jonas Dreßler
9b99b67fea Remove ClutterAllocationFlags
Those flags were removed from Clutter since they're pretty much unused,
so remove them here, too.

See https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1245

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1245
2020-05-20 15:12:03 +02:00
Jonas Ådahl
632a643994 Use paint and pick context to get framebuffer
Mutter and Clutter was changed to pass around the current target
framebuffer via the paint context instead of via the deprecated Cogl
framebuffer stack.

The framebuffer stack has also been removed from Cogl so change to use
the one in the paint context instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827
2019-12-03 19:07:15 +00:00
Florian Müllner
1e203f4631 cleanup: Replace deprecated lower/raise calls
Those methods have been deprecated for a long time, so
move to the drop-in replacement.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/808
2019-11-06 09:42:57 +01:00
Florian Müllner
43cf466d09 js: Replace Clutter.Actor.get_allocation_geometry()
The function was deprecated and has now been dropped from mutter.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/776
2019-10-21 18:41:35 +02:00
Marco Trevisan (Treviño)
c4c5c4fd5c cleanup: Use inheritance for Actor classes instead of composition
Remove the `this.actor = ...` and `this.actor._delegate = this` patterns in most
of classes, by inheriting all the actor container classes.

Uses interfaces when needed for making sure that multiple classes will implement
some required methods or to avoid redefining the same code multiple times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Florian Müllner
252e694979 util: Handle trailing LTR/RTL markers in URLs
Some electron apps apparently spread those generously over their
notification text, so may sure to not include them accidentally
in URLs.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1614
2019-09-16 20:41:47 +00:00
Florian Müllner
2fc4987c73 cleanup: Stop using Mainloop module
It is deprecated in favor of the regular GLib functions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/718
2019-09-12 19:09:24 +02:00
Florian Müllner
1778adae0d tests: Add Params.parse() unit tests
Commit 46874eed0 accidentally changed the behavior of the function in
an incompatible way. Before addressing the actual issue, add a reproducer
to the unit tests to hopefully prevent future breakage.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/615
2019-07-05 18:28:26 +02:00
Florian Müllner
1398aa6562 style: Fix indentation errors
While we have some style inconsistencies - mostly regarding split lines,
i.e. aligning to the first arguments vs. a four-space indent - there are
a couple of places where the spacing is simply wrong. Fix those.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Jonas Dreßler
02c76695e5 tests: Stop using global grabs
Global grabs are being removed from Clutter in favour of input device
grabs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
2019-07-02 01:18:15 +00:00
Florian Müllner
29b04fcbf2 style: Fix stray/missing semi-colons
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01:00
Florian Müllner
c6d57059ff tests: Work around import dependency loop
The markup unit test currently fails with the following message:

  TypeError: class heritage MessageList.Message is not an object or null

This is because MessageList imports other modules that end up importing
MessageList themselves in order to inherit from one of its classes. But
as the MessageList imports hasn't finished yet (it's still processing
its own imports), that class hasn't been defined yet.

Work around that by importing Main first, so that the importer can
process imports in a proper order.
2019-02-07 02:46:51 +01:00
Florian Müllner
e68dfed1f7 cleanup: Port GObject classes to JS6 classes
GJS added API for defining GObject classes with ES6 class syntax
last cycle, use it to port the remaining Lang.Class classes to
the new syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Florian Müllner
2fc1f1adbe cleanup: Remove obsolete Lang imports
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/350
2019-01-22 21:33:46 +00:00
Georges Basile Stavracas Neto
2ee321e0d8
tests: Stop using Shell.GenericContainer
The test doesn't look and behave like before, but they are
already broken in master anyway. This commit makes it work
without Shell.GenericContainer, but the test itself remains
to be fixed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Florian Müllner
5cc42b18b0 utils: Simplify URL regex to only support one layer of parentheses
The author of the original URL-matching regex warns[0] that the pattern may
cause certain regex engines to lock up with certain input, namely patterns
that contain parentheses. It turns out SpiderMonkey is affected, but rather
than switching to the author's improved version (that is still crazy), sim-
plify the pattern a bit by removing support for nested parentheses in URLs.
Even a single pair of parentheses is extremely rare, so this is unlikely to
make a noticeable difference (other than not locking up SpiderMonkey of
course) ...

[0] http://daringfireball.net/2010/07/improved_regex_for_matching_urls
2018-04-13 18:15:44 +00:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
cff0b81f32 tests: Set calendar event source
Ever since commit e9e30138bd (2011!), the calendar only initialized
the header at construction time. Set an event source to trigger an
update of the content area, which is what the test is mainly intended
for.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
2018-02-21 14:30:52 +01:00
Florian Müllner
23d6c4dcc0 tests: Fix import error in calendar
The Calendar module requires C_ at import time, which is only
available after Environment.init() has been called.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
2018-02-21 14:30:37 +01:00
Florian Müllner
66c86109dd tests: Fix a warning
Gjs now warns about excess parameters passed to functions, so don't
use Gtk.main_quit directly as signal callback.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
2018-02-21 14:30:30 +01:00
Florian Müllner
2e45be96b6 tests: Replace "for each" construct
It is no longer supported by recent mozjs versions, so replace it with
a regular for loop to unbreak the tests.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
2018-02-21 14:30:22 +01:00
Florian Müllner
5d1626aba1 tests: Avoid redeclarations with let
Mozjs made this error fatal a while ago, so those tests were broken
by gjs' JS engine updates.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
2018-02-21 14:30:09 +01:00
Florian Müllner
b7f083b1da tests: Fix gnome-shell theme import
The current import rule fails in two ways:
 - commit c62e7a6a moved the theme's stylesheet to the builddir
 - since commit 49c4ba56, assets are addressed as resource:// URIs

Fix both issues by loading and referencing the theme resource instead
of the stylesheet itself.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/38
2018-02-21 14:30:00 +01:00
Florian Müllner
d439456048 tests: Fix JS warning 2017-10-04 18:12:27 +02:00
Florian Müllner
4543ca1620 build: Run unit tests on meson test
Meson makes it easy to define unit tests, so hook up the existing
ones.

https://bugzilla.gnome.org/show_bug.cgi?id=786497
2017-10-04 18:12:27 +02:00
Florian Müllner
cf010cfd8f build: Drop autotools support
Complete the switch to meson and drop autotools support ...

https://bugzilla.gnome.org/show_bug.cgi?id=785153
2017-08-10 20:16:06 +02:00
Florian Müllner
c987d3d2c9 build: Support the meson build system
Meson is on track to replace autotools as the build system of choice,
so support it in addition to autotools. If all goes well, we'll
eventually be able to drop the latter ...

https://bugzilla.gnome.org/show_bug.cgi?id=783229
2017-07-20 00:20:54 +02:00
Florian Müllner
7f4e914b00 build: Move gvc submodule to /subprojects/gvc
When using the meson build system, gvc will be built as a subproject.
As meson restricts submodules to a subprojects/ directory in the
source tree root, move the submodule there.

https://bugzilla.gnome.org/show_bug.cgi?id=783229
2017-07-19 21:24:08 +02:00
Cosimo Cecchi
47b109d25b tests/entry: add interactive tests for entry hints
https://bugzilla.gnome.org/show_bug.cgi?id=783484
2017-06-14 14:00:57 -07:00
Cosimo Cecchi
708f65e388 tests/entry: add text-shadow
Also make the text larger and add an example string, since event
delivery does not seem to work properly under tests.

https://bugzilla.gnome.org/show_bug.cgi?id=783484
2017-06-14 14:00:57 -07:00