🔧 Use gnome-terminal for testing [generate-references]
This commit is contained in:
+1
-1
@@ -440,7 +440,7 @@ class Extension {
|
||||
// To make things deterministic during testing, we set the effect duration to 5
|
||||
// seconds.
|
||||
const duration =
|
||||
testMode ? 7500 : this._settings.get_int(effect.getNick() + '-animation-time');
|
||||
testMode ? 5000 : this._settings.get_int(effect.getNick() + '-animation-time');
|
||||
|
||||
// All animations are relative to the window's center.
|
||||
actor.set_pivot_point(0.5, 0.5);
|
||||
|
||||
+2
-2
@@ -57,8 +57,8 @@ var Doom = class {
|
||||
|
||||
// clang-format off
|
||||
shader.set_uniform_float(shader._uActorScale, 1, [testMode ? 1.0 : actorScale]);
|
||||
shader.set_uniform_float(shader._uHorizontalScale, 1, [settings.get_double('doom-horizontal-scale')]);
|
||||
shader.set_uniform_float(shader._uVerticalScale, 1, [testMode ? 500.0 : settings.get_double('doom-vertical-scale')]);
|
||||
shader.set_uniform_float(shader._uHorizontalScale, 1, [testMode ? 50.0 :settings.get_double('doom-horizontal-scale')]);
|
||||
shader.set_uniform_float(shader._uVerticalScale, 1, [testMode ? 150.0 : settings.get_double('doom-vertical-scale')]);
|
||||
shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('doom-pixel-size')]);
|
||||
// clang-format on
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ EXTENSION="burn-my-windows@schneegans.github.com"
|
||||
# All references images of the effects are captured at & cropped to this region
|
||||
# in the center of the screen. This is kind of arbitrary, but has been choosen so that
|
||||
# something is visible from each effect.
|
||||
CROP="100x100+910+480"
|
||||
CROP="100x100+900+500"
|
||||
|
||||
# Run the container. For more info, visit https://github.com/Schneegans/gnome-shell-pod.
|
||||
POD=$(podman run --rm --cap-add=SYS_NICE --cap-add=IPC_LOCK -td "${IMAGE}")
|
||||
@@ -110,7 +110,8 @@ capture_effect() {
|
||||
set_setting "open-preview-effect" "${1}"
|
||||
set_setting "close-preview-effect" "${1}"
|
||||
|
||||
do_in_pod gnome-extensions prefs "${EXTENSION}"
|
||||
sleep 1
|
||||
do_in_pod gnome-terminal
|
||||
sleep 3
|
||||
capture "tests/references/${1}-open-${SESSION}-${FEDORA_VERSION}.png"
|
||||
send_keystroke "Alt+F4"
|
||||
@@ -132,6 +133,11 @@ podman cp "${EXTENSION}.zip" "${POD}:/home/gnomeshell"
|
||||
do_in_pod gnome-extensions install "${EXTENSION}.zip"
|
||||
|
||||
|
||||
# ----------------------- install gnome-terminal (this is used for testing the animations)
|
||||
|
||||
do_in_pod sudo dnf install -y gnome-terminal
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------- start GNOME Shell
|
||||
|
||||
# Starting with GNOME 40, there is a "Welcome Tour" dialog popping up at first launch.
|
||||
@@ -141,6 +147,9 @@ if [[ "${FEDORA_VERSION}" -gt 33 ]]; then
|
||||
do_in_pod gsettings set org.gnome.shell welcome-dialog-last-shown-version "999" || true
|
||||
fi
|
||||
|
||||
# Make sure that new windows are opened in the center.
|
||||
do_in_pod gsettings set org.gnome.mutter center-new-windows true
|
||||
|
||||
echo "Starting $(do_in_pod gnome-shell --version)."
|
||||
do_in_pod systemctl --user start "${SESSION}@:99"
|
||||
sleep 10
|
||||
@@ -161,30 +170,36 @@ sleep 3
|
||||
|
||||
# --------------------------------------------------------------------- capture the images
|
||||
|
||||
# First we open the preferences and capture a portion of the dialog
|
||||
echo "Opening Preferences."
|
||||
do_in_pod gnome-extensions prefs "${EXTENSION}"
|
||||
sleep 3
|
||||
capture "tests/references/preferences-${SESSION}-${FEDORA_VERSION}.png"
|
||||
send_keystroke "Alt+F4"
|
||||
|
||||
# The test mode ensures that the animations are "frozen" and do not change in time.
|
||||
echo "Entering test mode."
|
||||
set_setting "test-mode" true
|
||||
do_in_pod gsettings set org.gnome.mutter center-new-windows true
|
||||
|
||||
capture_effect "energize-a"
|
||||
capture_effect "energize-b"
|
||||
capture_effect "fire"
|
||||
capture_effect "hexagon"
|
||||
capture_effect "incinerate"
|
||||
capture_effect "pixelate"
|
||||
capture_effect "tv"
|
||||
capture_effect "wisps"
|
||||
# capture_effect "energize-a"
|
||||
# capture_effect "energize-b"
|
||||
# capture_effect "fire"
|
||||
# capture_effect "hexagon"
|
||||
# capture_effect "incinerate"
|
||||
# capture_effect "pixelate"
|
||||
# capture_effect "tv"
|
||||
# capture_effect "wisps"
|
||||
|
||||
if [[ "${FEDORA_VERSION}" -gt 32 ]]; then
|
||||
capture_effect "apparition"
|
||||
# capture_effect "apparition"
|
||||
capture_effect "doom"
|
||||
fi
|
||||
|
||||
if [[ "${FEDORA_VERSION}" -gt 33 ]]; then
|
||||
capture_effect "trex"
|
||||
capture_effect "broken-glass"
|
||||
capture_effect "matrix"
|
||||
capture_effect "snap"
|
||||
fi
|
||||
# if [[ "${FEDORA_VERSION}" -gt 33 ]]; then
|
||||
# capture_effect "trex"
|
||||
# capture_effect "broken-glass"
|
||||
# capture_effect "matrix"
|
||||
# capture_effect "snap"
|
||||
# fi
|
||||
|
||||
echo "All reference images generated successfully."
|
||||
|
||||
+31
-4
@@ -119,6 +119,17 @@ compare_with_target() {
|
||||
fi
|
||||
}
|
||||
|
||||
# This searches the virtual screen of the container for a given target image (first
|
||||
# parameter). If it is not found, an error message (second paramter) is printed and the
|
||||
# script exits via the fail() method above.
|
||||
find_target() {
|
||||
echo "Searching for ${1} on the screen."
|
||||
POS=$(do_in_pod find-target.sh "${1}") || true
|
||||
if [[ -z "${POS}" ]]; then
|
||||
fail "${2}"
|
||||
fi
|
||||
}
|
||||
|
||||
# This simulates the given keystroke in the container. Simply calling "xdotool key $1"
|
||||
# sometimes fails to be recognized. Maybe the default 12ms between key-down and key-up
|
||||
# are too short for xvfb...
|
||||
@@ -145,15 +156,16 @@ test_effect() {
|
||||
set_setting "open-preview-effect" "${1}"
|
||||
set_setting "close-preview-effect" "${1}"
|
||||
|
||||
sleep 1
|
||||
do_in_pod gnome-terminal
|
||||
sleep 3
|
||||
do_in_pod gnome-extensions prefs "${EXTENSION}"
|
||||
sleep 5
|
||||
compare_with_target "${1}-open-${SESSION}-${FEDORA_VERSION}.png" "Failed to test ${1} window open effect!"
|
||||
send_keystroke "Alt+F4"
|
||||
sleep 5
|
||||
sleep 3
|
||||
compare_with_target "${1}-close-${SESSION}-${FEDORA_VERSION}.png" "Failed to test ${1} window close effect!"
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------- wait for the container to start up
|
||||
|
||||
echo "Waiting for D-Bus."
|
||||
@@ -167,6 +179,11 @@ podman cp "${EXTENSION}.zip" "${POD}:/home/gnomeshell"
|
||||
do_in_pod gnome-extensions install "${EXTENSION}.zip"
|
||||
|
||||
|
||||
# ----------------------- install gnome-terminal (this is used for testing the animations)
|
||||
|
||||
do_in_pod sudo dnf install -y gnome-terminal
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------- start GNOME Shell
|
||||
|
||||
# Starting with GNOME 40, there is a "Welcome Tour" dialog popping up at first launch.
|
||||
@@ -176,6 +193,9 @@ if [[ "${FEDORA_VERSION}" -gt 33 ]]; then
|
||||
do_in_pod gsettings set org.gnome.shell welcome-dialog-last-shown-version "999" || true
|
||||
fi
|
||||
|
||||
# Make sure that new windows are opened in the center.
|
||||
do_in_pod gsettings set org.gnome.mutter center-new-windows true
|
||||
|
||||
echo "Starting $(do_in_pod gnome-shell --version)."
|
||||
do_in_pod systemctl --user start "${SESSION}@:99"
|
||||
sleep 10
|
||||
@@ -195,10 +215,17 @@ sleep 3
|
||||
|
||||
# ---------------------------------------------------------------------- perform the tests
|
||||
|
||||
# First we open the preferences and check whether the window is shown on screen by
|
||||
# searching for a small snippet of the preferences dialog.
|
||||
echo "Opening Preferences."
|
||||
do_in_pod gnome-extensions prefs "${EXTENSION}"
|
||||
sleep 3
|
||||
find_target "tests/references/preferences-${SESSION}-${FEDORA_VERSION}.png" "Failed to open preferences!"
|
||||
send_keystroke "Alt+F4"
|
||||
|
||||
# The test mode ensures that the animations are "frozen" and do not change in time.
|
||||
echo "Entering test mode."
|
||||
set_setting "test-mode" true
|
||||
do_in_pod gsettings set org.gnome.mutter center-new-windows true
|
||||
|
||||
test_effect "energize-a"
|
||||
test_effect "energize-b"
|
||||
|
||||
Reference in New Issue
Block a user