Skip to content

Commit

Permalink
#1773: add encoding test
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@23127 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 10, 2019
1 parent 9d2bdce commit c923798
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/unittests/unit/server/mixins/display_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class DisplayMixinTest(ServerMixinTest):

def test_clipboard(self):
def test_display(self):
if os.environ.get("DISPLAY") and POSIX and not OSX and os.environ.get("GDK_BACKEND", "x11")=="x11":
from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
init_gdk_display_source()
Expand Down
39 changes: 39 additions & 0 deletions src/unittests/unit/server/mixins/encoding_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python
# This file is part of Xpra.
# Copyright (C) 2018 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import os
import unittest

from xpra.util import AdHocStruct
from xpra.os_util import POSIX, OSX
from unit.server.mixins.servermixintest_util import ServerMixinTest


class EncodingMixinTest(ServerMixinTest):

def test_encoding(self):
if os.environ.get("DISPLAY") and POSIX and not OSX and os.environ.get("GDK_BACKEND", "x11")=="x11":
from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
init_gdk_display_source()
from xpra.server.mixins.encoding_server import EncodingServer
opts = AdHocStruct()
opts.encoding = ""
opts.encodings = ["rgb", "png"]
opts.quality = 0
opts.min_quality = 20
opts.speed = 0
opts.min_speed = 20
opts.video_scaling = "auto"
opts.video_encoders = []
opts.csc_modules = []
self._test_mixin_class(EncodingServer, opts)

def main():
unittest.main()


if __name__ == '__main__':
main()
6 changes: 6 additions & 0 deletions src/unittests/unit/server/mixins/servermixintest_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ def tearDown(self):
def stop(self):
self.glib.timeout_add(1000, self.main_loop.quit)

def wait_for_threaded_init(self):
#we don't do threading yet,
#so no need to wait
pass

def _test_mixin_class(self, mclass, opts, caps=None, source_mixin_class=None):
x = self.mixin = mclass()
x.wait_for_threaded_init = self.wait_for_threaded_init
x.idle_add = self.glib.idle_add
x.timeout_add = self.glib.timeout_add
x.source_remove = self.glib.source_remove
Expand Down

0 comments on commit c923798

Please sign in to comment.