fixed label under 3d view

This commit is contained in:
ykcheungab
2026-09-15 21:50:37 +08:00
parent c2293d4d41
commit c538dbf074
7 changed files with 269 additions and 212 deletions
@@ -71,47 +71,40 @@ def _source(path: Path) -> SceneSource:
return SceneSource(path=path, kind="package", directory=path.parent)
def test_a_signed_package_opens_from_the_application(tmp_path):
@pytest.mark.parametrize("sealed", (False, True), ids=("signed", "sealed"))
def test_a_protected_package_opens_from_the_application(tmp_path, sealed):
"""The review's R4: the library could read it; the application could not.
With the verification key resolved from the preferences, the pane's own
``load_package`` accepts the package and the scene comes out intact.
With keys resolved from preferences, the pane's own loader accepts both signed
and sealed release packages and returns their scene intact.
"""
scene = synthetic.poc_scene()
package, verify_path, _key_path = _write_signed(tmp_path, scene, sealed=False)
package, verify_path, key_path = _write_signed(tmp_path, scene, sealed=sealed)
prefs = {PREF_VERIFY_KEY: str(verify_path)}
if sealed:
prefs.update(
{
PREF_CONTENT_KEY_FILE: str(key_path),
PREF_CONTENT_KEY_ID: KEY_ID,
}
)
keys = resolve_scene_keys({PREF_VERIFY_KEY: str(verify_path)})
assert keys.verify_key_pem is not None
assert keys.describe()["verify_key"] is True
assets = load_package(_source(package), _expected(scene), keys)
assert assets.geometry_id == scene.geometry_id
# The manifest's own hash, recomputed when the package was written: the synthetic
# scene's ``asset_hash`` is a placeholder until it goes through ``write_package``.
assert len(assets.asset_hash) == 64
def test_a_sealed_package_opens_with_the_content_key_from_the_preferences(tmp_path):
scene = synthetic.poc_scene()
package, verify_path, key_path = _write_signed(tmp_path, scene, sealed=True)
keys = resolve_scene_keys(
{
PREF_VERIFY_KEY: str(verify_path),
PREF_CONTENT_KEY_FILE: str(key_path),
PREF_CONTENT_KEY_ID: KEY_ID,
}
)
assert keys.provider is not None
keys = resolve_scene_keys(prefs)
described = keys.describe()
assert described["content_key"] is True
assert described["content_key_id"] == KEY_ID
# The description carries paths and ids, never key material.
assert CONTENT_KEY_HEX not in json.dumps(described)
assert keys.verify_key_pem is not None
assert described["verify_key"] is True
assert CONTENT_KEY_HEX.encode() not in keys.verify_key_pem
if sealed:
assert keys.provider is not None
assert described["content_key"] is True
assert described["content_key_id"] == KEY_ID
# The description carries paths and ids, never key material.
assert CONTENT_KEY_HEX not in json.dumps(described)
assets = load_package(_source(package), _expected(scene), keys)
assert assets.geometry_id == scene.geometry_id
# The writer replaces the synthetic scene's placeholder with the manifest hash.
assert len(assets.asset_hash) == 64
def test_without_the_verification_key_a_signed_package_is_refused(tmp_path):