-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify using the DisplayContext utility
git-svn-id: https://xpra.org/svn/Xpra/trunk@27940 3bb7dfac-3a0b-4e04-842a-767bc560f471
- Loading branch information
Showing
2 changed files
with
11 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,21 @@ | ||
#!/usr/bin/env python | ||
# This file is part of Xpra. | ||
# Copyright (C) 2018 Antoine Martin <[email protected]> | ||
# Copyright (C) 2018-2020 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 | ||
from unit.server_test_util import ServerTestUtil | ||
from unit.process_test_util import DisplayContext | ||
|
||
|
||
class DisplayMixinTest(ServerMixinTest, ServerTestUtil): | ||
class DisplayMixinTest(ServerMixinTest): | ||
|
||
def test_display(self): | ||
xvfb = None | ||
try: | ||
if POSIX and not OSX: | ||
display = self.find_free_display() | ||
xvfb = self.start_Xvfb(display) | ||
os.environ["DISPLAY"] = display | ||
os.environ["GDK_BACKEND"] = "x11" | ||
from xpra.x11.bindings.posix_display_source import init_posix_display_source #@UnresolvedImport | ||
init_posix_display_source() | ||
from xpra.x11.gtk3.gdk_display_util import verify_gdk_display | ||
verify_gdk_display(display) | ||
with DisplayContext(): | ||
self.do_test_display() | ||
finally: | ||
if xvfb: | ||
xvfb.terminate() | ||
|
||
def do_test_display(self): | ||
from xpra.server.mixins.display_manager import DisplayManager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
#!/usr/bin/env python | ||
# This file is part of Xpra. | ||
# Copyright (C) 2018 Antoine Martin <[email protected]> | ||
# Copyright (C) 2018-2020 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 | ||
from unit.process_test_util import DisplayContext | ||
|
||
|
||
class InputMixinTest(ServerMixinTest): | ||
|
||
def test_input(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.input_server import InputServer | ||
from xpra.server.source.input_mixin import InputMixin | ||
opts = AdHocStruct() | ||
self._test_mixin_class(InputServer, opts, {}, InputMixin) | ||
with DisplayContext(): | ||
from xpra.server.mixins.input_server import InputServer | ||
from xpra.server.source.input_mixin import InputMixin | ||
opts = AdHocStruct() | ||
self._test_mixin_class(InputServer, opts, {}, InputMixin) | ||
|
||
def main(): | ||
unittest.main() | ||
|