Guards tests: version drift of any size is refused; the texture fixture's aspect is not a power-of-two ratio
The untested-cultcache test now refuses 0.4.0, 0.3.1 and 0.3 as well as 9.9.9 (a major-only comparison survived). smoke_package's hull map is 4096x1000, so the scaled size (2048x500, 512x125) is not what a clamp of both sides or of the other axis would give. Builds: yes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4acf05da46
commit
873ee6eae4
2 changed files with 12 additions and 11 deletions
|
|
@ -105,7 +105,7 @@ def texture_cap_pass(addon, hull_object, albedo, detail, limit, expected, glb):
|
|||
raise SystemExit(f"Texture cap {limit}: Package was refused")
|
||||
if glb_image_sizes(glb) != sorted(expected):
|
||||
raise SystemExit(f"Texture cap {limit}: the GLB images are {glb_image_sizes(glb)}, not {sorted(expected)}")
|
||||
if tuple(albedo.size) != (4096, 1024) or tuple(detail.size) != (256, 256):
|
||||
if tuple(albedo.size) != (4096, 1000) or tuple(detail.size) != (256, 256):
|
||||
raise SystemExit(f"Texture cap {limit}: Package changed a .blend image to {tuple(albedo.size)}, {tuple(detail.size)}")
|
||||
nodes = [node.image for slot in hull_object.material_slots for node in slot.material.node_tree.nodes
|
||||
if node.type == "TEX_IMAGE"]
|
||||
|
|
@ -250,7 +250,7 @@ def main():
|
|||
ship = bpy.data.collections.new("Smoke Gale")
|
||||
scene.collection.children.link(ship)
|
||||
hull = tagged(ship, "Hull", tetrahedron("Hull"))
|
||||
albedo = textured(hull, "Hull Albedo", 4096, 1024)
|
||||
albedo = textured(hull, "Hull Albedo", 4096, 1000)
|
||||
detail = textured(hull, "Hull Detail", 256, 256)
|
||||
hull.data.polygons[0].material_index = 1 # the exporter writes only materials some face uses
|
||||
tagged(ship, "Map Icon", quad("Map Icon"), "map-icon", "map", (0, 0, -1))
|
||||
|
|
@ -281,11 +281,11 @@ def main():
|
|||
result, report = package(aetheria_ships)
|
||||
if result != {"FINISHED"}:
|
||||
raise SystemExit("Pass 1: the validator refused the primitive ship")
|
||||
# The texture cap: the 4096 x 1024 map exports at 2048 x 512 (the longest side at the cap, the aspect kept), the
|
||||
# The texture cap: the 4096 x 1000 map exports at 2048 x 500 (the longest side at the cap, the aspect kept), the
|
||||
# 256 x 256 one is under the cap and exports as it is, and the preference decides the cap.
|
||||
glb = Path(path).with_name("ship.glb")
|
||||
texture_cap_pass(aetheria_ships, hull, albedo, detail, 2048, [(2048, 512), (256, 256)], glb)
|
||||
texture_cap_pass(aetheria_ships, hull, albedo, detail, 512, [(512, 128), (256, 256)], glb)
|
||||
texture_cap_pass(aetheria_ships, hull, albedo, detail, 2048, [(2048, 500), (256, 256)], glb)
|
||||
texture_cap_pass(aetheria_ships, hull, albedo, detail, 512, [(512, 125), (256, 256)], glb)
|
||||
bpy.context.preferences.addons["aetheria_ships"].preferences.max_texture = 2048
|
||||
print("TEXTURE_CAP_OK")
|
||||
# A collection with no Ship Root is packaged exactly as before: the frame step makes and moves nothing.
|
||||
|
|
|
|||
|
|
@ -581,13 +581,14 @@ class UntestedCultCacheTests(ShipFileCase):
|
|||
return str(root)
|
||||
|
||||
def test_a_different_version_is_refused_naming_the_version_and_the_packages_path(self):
|
||||
stub = self.packages("9.9.9")
|
||||
before = self.bytes()
|
||||
for call in (lambda: ship_cc.read(self.path, stub), lambda: ship_cc.read_layout(self.path, stub)):
|
||||
with self.assertRaises(ValueError) as caught:
|
||||
call()
|
||||
self.assertIn("9.9.9", str(caught.exception))
|
||||
self.assertIn(stub, str(caught.exception))
|
||||
for version in ("9.9.9", "0.4.0", "0.3.1", "0.3"): # any drift, not only a different major
|
||||
stub = self.packages(version)
|
||||
for call in (lambda: ship_cc.read(self.path, stub), lambda: ship_cc.read_layout(self.path, stub)):
|
||||
with self.subTest(version=version), self.assertRaises(ValueError) as caught:
|
||||
call()
|
||||
self.assertIn(version, str(caught.exception))
|
||||
self.assertIn(stub, str(caught.exception))
|
||||
self.assertEqual(before, self.bytes())
|
||||
|
||||
def test_a_save_through_an_untested_cultcache_writes_nothing(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue