예제 #1
0
def run(helper):
    cfg = helper.query_master("get_cfg")
    dbus = helper.query_master("get_x_var", "DBUS_SESSION_BUS_ADDRESS",
                               cfg["client_vm"])
    helper.info("Dbus: %s.", repr(dbus))
    os.environ['DBUS_SESSION_BUS_ADDRESS'] = dbus
    os.environ['DISPLAY'] = ":0.0"
    sys.path.append(os.path.dirname(__file__))
    try:
        # Up to this point DBUS_SESSION_BUS_ADDRESS / DISPLAY must be set.
        import rv
    except Exception as e:
        helper.info("Cannot import rv: %s.", repr(e))
        return 1
    try:
        # Exec new instance RV, without arguments. RV shows 'Connection
        # details.' dialog.
        rv_app = rv.Application(method=cfg["method"])
        # Test assumes there is only one virtual display.
        assert rv_app.dsp_count() == 1
        if rv_app.dsp1.is_fullscreen():
            rv_app.dsp1.fullscreen_off()
            helper.info("Fs is off.")
            rv_app.dsp1.fullscreen_on()
            helper.info("Fs is on.")
        else:
            rv_app.dsp1.fullscreen_on()
            helper.info("Fs is on.")
            rv_app.dsp1.fullscreen_off()
            helper.info("Fs is off.")
    except Exception as e:
        helper.info("Test failed with: %s.", repr(e))
        return 1
    helper.info("Test passed.")
    return 0
예제 #2
0
def run(helper):
    cfg = helper.query_master("get_cfg")
    dbus = helper.query_master("get_x_var", "DBUS_SESSION_BUS_ADDRESS",
                               cfg["client_vm"])
    helper.info("Dbus: %s.", repr(dbus))
    os.environ['DBUS_SESSION_BUS_ADDRESS'] = dbus
    uri = helper.query_master("get_uri")
    helper.info("Uri: %s.", repr(uri))
    os.environ['DISPLAY'] = ":0.0"
    sys.path.append(os.path.dirname(__file__))
    try:
        # Up to this point DBUS_SESSION_BUS_ADDRESS / DISPLAY must be set.
        import rv
    except Exception as e:
        helper.info("Cannot import rv: %s.", repr(e))
        return 1
    # Fail if there is a running RV.
    try:
        rv.Application(method="mouse")
    except rv.GeneralError:
        # No running RV. Pass.
        pass
    else:
        raise Exception("Found runing RV.")
    try:
        # Exec new instance RV, without arguments. RV shows 'Connection
        # details' dialog.
        rv_p = subprocess.Popen(["remote-viewer"], shell=True)
        rv_app = rv.Application(method="mouse")
        rv_app.diag_connect.connect(uri, ticket=None)
        assert rv_app.dsp1
    except Exception as e:
        helper.info("Test failed with: %s.", repr(e))
        return 1
    helper.info("Test passed.")
    return 0
예제 #3
0
def run(helper):
    cfg = helper.query_master("get_cfg")
    dbus = helper.query_master("get_x_var", "DBUS_SESSION_BUS_ADDRESS",
                               cfg["client_vm"])
    helper.info("Dbus: %s.", repr(dbus))
    os.environ['DBUS_SESSION_BUS_ADDRESS'] = dbus
    uri = helper.query_master("get_uri")
    helper.info("Uri: %s.", repr(uri))
    os.environ['DISPLAY'] = ":0.0"
    sys.path.append(os.path.dirname(__file__))
    try:
        # Up to this point DBUS_SESSION_BUS_ADDRESS / DISPLAY must be set.
        import rv
    except Exception as e:
        helper.info("Cannot import rv: %s.", repr(e))
        return 1
    try:
        rv_app = rv.Application()
    except Exception as e:
        # No running RV. Pass.
        helper.info("Test failed with: %s.", repr(e))
        return 1
    cdir = os.path.dirname(__file__)
    with open(os.path.join(cdir, '..', cfg["rv_file"]), 'r') as f:
        ver_lines = f.readlines()
        ver_line = [l for l in ver_lines if 'versions' in l][0]
        ver = ver_line.split(':')[-1].strip()
    error_message = cfg["error_msg"] % ver
    if cfg.has_key("new_ver"):
        error_message += ', see %s for details' % cfg["new_ver"]
    try:
        rv_app.app.childNamed(error_message)
    except Exception as e:
        helper.info("Test failed with: %s.", repr(e))
        return 1
    helper.info("Test passed. Alert message: '%s' was found.", error_message)
    return 0
예제 #4
0
                   dest="method")
group.add_argument("-k",
                   "--hotkeys",
                   help="Use hot keys.",
                   action="store_const",
                   const="hot_key",
                   dest="method")
group.add_argument("-m",
                   "--mouse",
                   help="Use mouse.",
                   action="store_const",
                   const="mouse",
                   dest="method")
group.add_argument("-w",
                   "--windowmanager",
                   help="Use window manager.",
                   action="store_const",
                   const="wm_key",
                   dest="method")
args = parser.parse_args()

app = rv.Application(method=args.method)

# Test assumes there is only one virtual display.
assert app.dsp_count() == 1

if util.strtobool(args.fs):
    app.dsp1.fullscreen_on()
else:
    app.dsp1.fullscreen_off()
예제 #5
0
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

parser = argparse.ArgumentParser(description='Connect with remote-viewer.')
parser.add_argument("url", help="Url, eg: spice://127.0.0.1:5960")
parser.add_argument("-t",
                    "--ticket",
                    help="Spice ticket.",
                    default="",
                    nargs="?")
args = parser.parse_args()

assert utils.isA11yEnabled(), "A11 accessibility is disabled."

try:
    rv.Application(method="mouse")
except rv.GeneralError:
    pass
else:
    raise Exception("Found runing RV.")

# Exec new instance RV, without arguments. RV shows 'Connection details.'
# dialog.

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

rv_p = subprocess.Popen(["remote-viewer"])
rv_app = rv.Application(method="mouse")
rv_app.diag_connect.connect(args.url, ticket=args.ticket)
assert rv_app.dsp1