Files
DroidDeck/tools/tests/test_quest_presentation.py
MaxsTechReview c5577478ca chore: remove source comments and unused code, translate every missing string (#1965)
* chore(i18n): translate every missing string in all locales

Adds the 87 strings the bottom-screen Dashboard and in-game stats pages
introduced to all 32 locales, plus the 51 older settings strings Japanese
and the 50 Chinese locales were still missing. Every locale now has all
3456 translatable strings with the same placeholders as English.

Also translates 36 entries that were still English where the language
does not use the English word, and makes es-419 touch_app_id use the same
%1$s placeholder as English.

* chore(patches): drop comments from the lines downstream patches add

Removes comment lines and trailing comments from lines our patches add,
with hunk headers recounted. Lines that a later patch uses as context
and the upstream backport 0123 are left as they are.

The gamescope, FEX, proot and xodus series still apply to their pinned
sources, and the patched trees differ only in those comments.
test_hud_frames now finds the HUD writer by its first declaration.

* docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix

These were credited only in source headers and NOTICE files.

* chore: remove source comments and unused functions

Removes explanatory comments from first-party Kotlin, Java, C, C++,
Rust, TypeScript, Python, shell, Gradle, CMake and workflow files.
License and attribution headers stay, and vendored third-party trees,
generated files and license files are untouched. A shellcheck directive
is kept, and udevmon's fallthrough comments became fallthrough attributes.

Syntax trees and token streams match the previous sources apart from the
comments and Python docstrings. Module docstrings that argparse prints
are kept, and device-smoke.sh prints the same --help text from a heredoc.

Also removes 37 functions and 4 fields that nothing referenced.

* chore: remove comments from the Syncthing integration and the latest main sources

* docs: credit Syncthing and the syncthing-android fork

* chore(i18n): translate the Syncthing strings in all locales

The 107 strings the Syncthing integration added are now in all 32 locales.
sync_web_path_locked names the Syncthing tab by its label.

* docs: credit @xXJSONDeruloXx for the HUD metric readers

The CPU, GPU load, thermal and battery readers come from their
PerformanceHudView pull requests #777, #877, #991, #1406 and #1573.
The FusionHUD credit line is unchanged.

* docs: credit the HUD metric readers to @xXJSONDeruloXx's work
2026-11-01 16:27:27 -05:00

74 lines
3.6 KiB
Python

from pathlib import Path
import shutil
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
@unittest.skipUnless(shutil.which('cc'), 'needs a C compiler')
class QuestBackdropTest(unittest.TestCase):
def test_first_frame_requires_client_content(self):
source = (ROOT / 'app/src/main/cpp/waylandcomp/src/vk_present.c').read_text()
start = source.index('\nint vkp_render(')
end = source.index('\nint vkp_render_hdr(', start)
with tempfile.TemporaryDirectory() as folder:
work = Path(folder)
(work / 'vkp_render_under_test.inc').write_text(source[start:end])
binary = work / 'test-first-frame'
subprocess.run(['cc', '-std=c11', '-Wall', '-Wextra',
'-Wno-unused-parameter', '-Wno-unused-function', f'-I{work}',
str(ROOT / 'tools/quest/test_first_frame.c'), '-o', str(binary)],
check=True, capture_output=True, text=True)
result = subprocess.run([str(binary)], capture_output=True, text=True, timeout=10)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn('PASS: Quest first-frame', result.stdout)
def test_backdrop_lifecycle_and_failed_buffer_initialization(self):
with tempfile.TemporaryDirectory() as folder:
work = Path(folder)
android = work / 'android'
android.mkdir()
(android / 'rect.h').write_text('''#pragma once
#include <stdint.h>
typedef struct ARect { int32_t left, top, right, bottom; } ARect;
''')
(android / 'native_window.h').write_text('''#pragma once
typedef struct ANativeWindow ANativeWindow;
''')
(android / 'hardware_buffer.h').write_text('''#pragma once
#include <stdint.h>
#include "rect.h"
typedef struct AHardwareBuffer AHardwareBuffer;
typedef struct { uint32_t width,height,layers,format; uint64_t usage;
uint32_t stride,rfu0; uint64_t rfu1; } AHardwareBuffer_Desc;
#define AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM 1
#define AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM 0x2b
#define AHARDWAREBUFFER_USAGE_CPU_READ_RARELY 2ULL
#define AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY 32ULL
#define AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE 256ULL
#define AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT 512ULL
#define AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY 2048ULL
int AHardwareBuffer_allocate(const AHardwareBuffer_Desc *, AHardwareBuffer **);
void AHardwareBuffer_describe(const AHardwareBuffer *, AHardwareBuffer_Desc *);
int AHardwareBuffer_lock(AHardwareBuffer *, uint64_t, int32_t, const ARect *, void **);
int AHardwareBuffer_unlock(AHardwareBuffer *, int32_t *);
void AHardwareBuffer_release(AHardwareBuffer *);
''')
binary = work / 'test-presentation'
subprocess.run(['cc', '-std=c11', '-O1', '-g', '-Wall', '-Wextra',
'-Wno-unused-parameter', '-Wno-unused-function',
'-ffunction-sections', '-fdata-sections', '-Wl,--gc-sections',
'-fsanitize=address,undefined', f'-I{work}',
f'-I{ROOT}/app/src/main/cpp/waylandcomp/prebuilt/include',
str(ROOT / 'tools/quest/test_presentation.c'), '-ldl', '-pthread',
'-o', str(binary)], check=True, capture_output=True, text=True)
result = subprocess.run([str(binary)], capture_output=True, text=True, timeout=10)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn('PASS: Quest backdrop', result.stdout)
if __name__ == '__main__':
unittest.main()