Skip to content

Commit daac9e1

Browse files
committed
Strengthen native QR and combined-menu acceptance checks
1 parent bedf131 commit daac9e1

6 files changed

Lines changed: 106 additions & 4 deletions

File tree

‎Unity-QuestVisionKit/Assets/Diagnostics/CameraKitState.cs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System;
33
using Meta.XR;
44
using Meta.XR.MRUtilityKit;
5+
using Meta.XR.MRUtilityKitSamples.QRCodeDetection;
56
using UnityEngine;
67
using UnityEngine.SceneManagement;
78
using XRDevRob.QUAK;
@@ -16,6 +17,7 @@ public sealed class CameraKitState : MonoBehaviour, IQuakStateProvider
1617
private int[] _frames;
1718
private float[] _lastFrameTimes;
1819
private ObjectDetector _detector;
20+
private SampleMenu _menu;
1921
private int _errors;
2022
public string ProviderId => "quest-camera-kit";
2123

@@ -36,6 +38,7 @@ private void Awake()
3638
_frames = new int[_cameras.Length];
3739
_lastFrameTimes = new float[_cameras.Length];
3840
_detector = FindAnyObjectByType<ObjectDetector>();
41+
_menu = FindAnyObjectByType<SampleMenu>();
3942
}
4043

4144
private void OnEnable()
@@ -75,6 +78,10 @@ public string CaptureStateJson()
7578
minFramesObserved = _cameras.Length == 0 ? 0 : int.MaxValue,
7679
inferenceCount = _detector ? _detector.CompletedInferenceCount : 0,
7780
errorCount = _errors,
81+
menuVisible = _menu && _menu.IsVisible,
82+
menuSampleCount = _menu ? _menu.SampleCount : 0,
83+
nativeQrHasPermissions = QRCodeManager.HasPermissions,
84+
nativeQrTrackedCount = QRCodeManager.ActiveTrackedCount,
7885
nativeQrSupported = MRUK.Instance && MRUK.Instance.QRCodeTrackingSupported,
7986
nativeQrTrackingEnabled = MRUK.Instance && MRUK.Instance.SceneSettings.TrackerConfiguration.QRCodeTrackingEnabled
8087
};
@@ -97,6 +104,10 @@ private sealed class Snapshot
97104
public float maxFrameAgeSeconds;
98105
public int inferenceCount;
99106
public int errorCount;
107+
public bool menuVisible;
108+
public int menuSampleCount;
109+
public bool nativeQrHasPermissions;
110+
public int nativeQrTrackedCount;
100111
public bool nativeQrSupported;
101112
public bool nativeQrTrackingEnabled;
102113
}

‎Unity-QuestVisionKit/Assets/Samples/Common/Scripts/SampleMenu.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public sealed class SampleMenu : MonoBehaviour
1616
private int _selected;
1717
private bool _stickHeld;
1818
private bool _loading;
19+
public bool IsVisible => _canvas && _canvas.enabled;
20+
public int SampleCount => _paths?.Length ?? 0;
1921

2022
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
2123
private static void Install()
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"schema_version": 1,
3+
"name": "Combined samples startup and menu check",
4+
"description": "Checks the real ColorPicker camera and initial six-sample menu. Does not establish controller-driven scene switching.",
5+
"target": "quest",
6+
"expected_application_id": "com.xrdevrob.questcamerakit.allsamples",
7+
"expected_scene": "ColorPicker",
8+
"visual_evidence": {
9+
"required": true,
10+
"capture_policy": "unattended",
11+
"fps": 2,
12+
"max_duration_seconds": 20,
13+
"focus_clips": "marked-and-failures",
14+
"target_highlight": "focused-clips"
15+
},
16+
"steps": [
17+
{
18+
"id": "observe-sample",
19+
"provider": "unity",
20+
"tool": "quak_get_state",
21+
"arguments": {},
22+
"wait_timeout_seconds": 15,
23+
"poll_interval_seconds": 0.5,
24+
"assertions": [
25+
{
26+
"path": "$.data.data.result.state.quest-camera-kit.scene",
27+
"op": "equals",
28+
"expected": "ColorPicker"
29+
},
30+
{
31+
"path": "$.data.data.result.state.quest-camera-kit.errorCount",
32+
"op": "equals",
33+
"expected": 0
34+
},
35+
{
36+
"path": "$.data.data.result.state.quest-camera-kit.cameraCount",
37+
"op": "equals",
38+
"expected": 1
39+
},
40+
{
41+
"path": "$.data.data.result.state.quest-camera-kit.playingCameraCount",
42+
"op": "equals",
43+
"expected": 1
44+
},
45+
{
46+
"path": "$.data.data.result.state.quest-camera-kit.minFramesObserved",
47+
"op": "gte",
48+
"expected": 10
49+
},
50+
{
51+
"path": "$.data.data.result.state.quest-camera-kit.maxFrameAgeSeconds",
52+
"op": "lte",
53+
"expected": 2
54+
},
55+
{
56+
"path": "$.data.data.result.state.quest-camera-kit.menuVisible",
57+
"op": "equals",
58+
"expected": true
59+
},
60+
{
61+
"path": "$.data.data.result.state.quest-camera-kit.menuSampleCount",
62+
"op": "equals",
63+
"expected": 6
64+
}
65+
],
66+
"failure_guidance": "Check camera permissions, headset focus, scene references, and device logs; a running app without fresh camera frames is not a pass."
67+
}
68+
]
69+
}

‎Unity-QuestVisionKit/quak-tests/QRCodeDetection.json‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schema_version": 1,
3-
"name": "QRCodeDetection device camera and runtime check",
4-
"description": "Observes the real sample camera and processing pipeline. This does not assert semantic detection accuracy or a user interaction.",
3+
"name": "Native QR tracking with a visible real QR code",
4+
"description": "Requires spatial-data permission, native tracking support, enabled tracking, and at least one QR trackable emitted by MRUK. Hold a known QR code in view and review its payload and alignment visually.",
55
"target": "quest",
66
"expected_application_id": "com.xrdevrob.questcamerakit.qrcodedetection",
77
"expected_scene": "QRCodeDetection",
@@ -36,9 +36,24 @@
3636
"path": "$.data.data.result.state.quest-camera-kit.nativeQrSupported",
3737
"op": "equals",
3838
"expected": true
39+
},
40+
{
41+
"path": "$.data.data.result.state.quest-camera-kit.nativeQrHasPermissions",
42+
"op": "equals",
43+
"expected": true
44+
},
45+
{
46+
"path": "$.data.data.result.state.quest-camera-kit.nativeQrTrackingEnabled",
47+
"op": "equals",
48+
"expected": true
49+
},
50+
{
51+
"path": "$.data.data.result.state.quest-camera-kit.nativeQrTrackedCount",
52+
"op": "gte",
53+
"expected": 1
3954
}
4055
],
41-
"failure_guidance": "Check camera permissions, headset focus, scene references, and device logs; a running app without fresh camera frames is not a pass."
56+
"failure_guidance": "Check native QR runtime support, spatial-data permission, and the tracking toggle. Hold a real QR code in view. A supported API without a tracked QR code is not a pass."
4257
}
4358
]
4459
}

‎docs/testing.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Unity -batchmode -nographics -quit \
2121
-logFile /absolute/path/checks.log
2222
```
2323

24-
These cover stereo PCM/WAV headers and samples, the bundled model's CPU output contract on a synthetic black input, command JSON escaping (including null and control characters). `MaintenanceChecks.CheckWavStereo` is the focused regression that failed before the stereo fix.
24+
These cover stereo PCM/WAV headers and samples, the bundled model's CPU output contract on a synthetic black input, command JSON escaping (including null and control characters), and native QR overlay transitions through absent/present/lost bounds. `MaintenanceChecks.CheckWavStereo` is the focused regression that failed before the stereo fix.
2525

2626
Run `QuestCameraKit.Editor.MaintenanceChecks.AuditScenes` the same way to inspect all seven sample scenes for missing MonoBehaviours. Its `scene-audit.txt` is written at the repository root. It opens scenes without saving them.
2727

@@ -45,6 +45,9 @@ For a **non-development release build**, disable `XR_APILAYER_XRDEVROB_quak_inje
4545

4646
## Quak device checks
4747

48+
Use `quak-tests/AllSamples.json` for the combined app's startup/menu/camera check. The native QR plan requires an actual QR trackable from MRUK; a merely supported API cannot pass it. Present a known QR code and visually compare its decoded payload and spatial alignment. Neither startup plan proves controller-driven navigation: open the menu, visit every sample, return to the first, and repeat on the headset to check camera/scene cleanup.
49+
50+
4851
XRQA is now named **Quak**. Use the matching [v0.4.0-alpha.1 release](https://github.com/xrdevrob/quak/releases/tag/v0.4.0-alpha.1), verify its `SHA256SUMS`, and install the Python wheel in an isolated environment. The Unity package in this repository is that same release. Run `quak setup --project /absolute/path/Unity-QuestVisionKit` to create local CLI configuration when needed.
4952

5053
For Android signature verification, put the Unity Android **OpenJDK/bin** directory on `PATH` or set `JAVA_HOME` to that OpenJDK installation. Also make `adb` and `ffmpeg` available to Quak.

‎scripts/check_repo.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def check() -> None:
1818
path = ROOT / name
1919
if not path.is_file():
2020
continue
21+
if name.lower().endswith("/zxing.dll"):
22+
failures.append(f"{name}: native QR tracking must not ship a separate decoder")
2123
if name.startswith('Unity-QuestVisionKit/Assets/'):
2224
with path.open('rb') as stream:
2325
prefix = stream.read(128)

0 commit comments

Comments
 (0)