From cf6a572d130b9b2e619d97b537075d5826dd5fe3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 17 Aug 2016 18:58:28 +0200 Subject: Fix errors and start on test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/test | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 src/test (limited to 'src/test') diff --git a/src/test b/src/test new file mode 100755 index 0000000..7f3c997 --- /dev/null +++ b/src/test @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +''' +pylibcoopgamma -- Python library for interfacing with cooperative gamma servers +Copyright (C) 2016 Mattias Andrée (maandree@kth.se) + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this library. If not, see . +''' + +import os, sys + +os.chdir('/'.join(sys.argv[0].split('/')[:-1])) +sys.path.append('../bin') + +import libcoopgamma +cg = libcoopgamma + +if len(sys.argv) == 1: + + print('\033[1m%s:\033[m' % 'Methods') + for m in cg.get_methods(): + print(m) + print() + + print('\033[1m%s:\033[m' % 'Method') + print(cg.get_method_and_site()[0]) + print() + + print('\033[1m%s:\033[m' % 'Site') + print(cg.get_method_and_site()[1]) + print() + + print('\033[1m%s:\033[m' % 'PID file') + print(cg.get_pid_file()) + print() + + print('\033[1m%s:\033[m' % 'Socket') + print(cg.get_socket_file()) + print() + + g = cg.Context() + g.connect() + g.detach() + gstr = repr(g) + del g + + argv0 = './' + sys.argv[0].split('/')[-1] + os.execl(argv0, argv0, gstr) +else: + g = eval(sys.argv[1]) + g.attach() + +print('\033[1m%s:\033[m' % 'CRTC:s') +for crtc in g.get_crtcs_sync(): + print(crtc) +print() + +print(g.get_gamma_info_sync(crtc)) +print(g.get_gamma_sync(cg.FilterQuery(crtc = crtc))) + +del g + -- cgit v1.2.3-70-g09d2