The open source OpenXR runtime
1#!/usr/bin/env python3
2# Copyright 2024, Collabora, Ltd.
3#
4# SPDX-License-Identifier: BSL-1.0
5#
6# Author: Rylie Pavlik <rylie.pavlik@collabora.com>
7"""
8Tests of a single app without inducing extra session state changes.
9
10See README.md in this directory for requirements and running instructions.
11"""
12
13import time
14
15import pytest
16from conftest import helloxr_gles_activity, helloxr_gles_pkg
17
18# Ignore missing docstrings:
19# flake8: noqa: D103
20
21skipif_not_adb = pytest.mark.skipif(
22 "not config.getoption('adb')", reason="--adb not passed to pytest"
23)
24
25# All the tests in this module require a device and ADB.
26pytestmark = [pytest.mark.adb, skipif_not_adb]
27
28
29def test_just_launch(adb):
30 # Just launch activity and make sure it starts OK.
31 adb.start_activity(helloxr_gles_activity)
32
33 time.sleep(5)
34
35 adb.check_for_crash()
36
37
38def test_launch_and_monkey(adb):
39 # Launch activity
40 adb.start_activity(helloxr_gles_activity)
41 time.sleep(2)
42
43 # Release the monkey! 1k events.
44 adb.adb_call(
45 [
46 "adb",
47 "shell",
48 "monkey",
49 "-p",
50 helloxr_gles_pkg,
51 "-v",
52 "1000",
53 # seed
54 "-s",
55 "100",
56 "--pct-syskeys",
57 "0",
58 ]
59 )
60
61 adb.check_for_crash()