Add virtual buffer to make the GTK tests work

This commit is contained in:
Sumner Evans
2020-05-30 01:05:44 -06:00
parent 77aa2c4321
commit 0d8c27504f
5 changed files with 16 additions and 6 deletions

View File

@@ -33,6 +33,9 @@ test:
before_script:
- ./cicd/install-project-deps.sh
- ./cicd/start-dbus.sh
- apt install xvfb
- Xvfb :119 -screen 0 1024x768x16 &
- export DISPLAY=:119
script:
- pipenv run ./cicd/pytest.sh
artifacts:

View File

@@ -33,6 +33,7 @@ RUN apt update && \
python3-pip \
tk-dev \
wget \
xvfb \
xz-utils \
zlib1g-dev

View File

@@ -5,7 +5,7 @@
<metadata_license>FSFAP</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>Sublime Music</name>
<summary>Native Subsonic client for Linux</summary>
<summary>A native GTK music player with *sonic support</summary>
<description>
<p>

View File

@@ -258,14 +258,14 @@ class SublimeMusicApp(Gtk.Application):
inital_sync_result = AdapterManager.initial_sync()
inital_sync_result.add_done_callback(lambda _: self.update_window())
# Start a loop for testing the ping.
def ping_update():
# Start a loop for periodically updating the window every 10 seconds.
def periodic_update():
if self.exiting:
return
self.update_window()
GLib.timeout_add(10000, ping_update)
GLib.timeout_add(10000, periodic_update)
GLib.timeout_add(10000, ping_update)
GLib.timeout_add(10000, periodic_update)
# Prompt to load the play queue from the server.
if self.app_config.server.sync_enabled:
@@ -536,6 +536,8 @@ class SublimeMusicApp(Gtk.Application):
if self.app_config.state.current_song_index < 0:
return
self.app_config.state.playing = not self.app_config.state.playing
if self.player.song_loaded:
self.player.toggle_play()
self.save_play_queue()
@@ -543,7 +545,6 @@ class SublimeMusicApp(Gtk.Application):
# This is from a restart, start playing the file.
self.play_song(self.app_config.state.current_song_index)
self.app_config.state.playing = not self.app_config.state.playing
self.update_window()
def on_next_track(self, *args):

5
tests/common_ui_tests.py Normal file → Executable file
View File

@@ -1,5 +1,10 @@
from pathlib import Path
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk # noqa: F401
from sublime.ui import common