Extract seed resolution nodes
This commit is contained in:
@@ -25,6 +25,7 @@ if str(ROOT) not in sys.path:
|
||||
|
||||
import caption_naturalizer # noqa: E402
|
||||
import category_library # noqa: E402
|
||||
import __init__ as sxcp_nodes # noqa: E402
|
||||
import krea_formatter # noqa: E402
|
||||
import prompt_builder as pb # noqa: E402
|
||||
import sdxl_formatter # noqa: E402
|
||||
@@ -1661,6 +1662,50 @@ def smoke_formatter_metadata_fixtures() -> None:
|
||||
_expect(term in caption_text, f"{name}.caption missing {term!r}")
|
||||
|
||||
|
||||
def smoke_node_utility_registration() -> None:
|
||||
required_nodes = [
|
||||
"SxCPGlobalSeed",
|
||||
"SxCPSeedControl",
|
||||
"SxCPSeedLocker",
|
||||
"SxCPSDXLBucketSize",
|
||||
"SxCPKrea2ResolutionSelector",
|
||||
]
|
||||
for node_name in required_nodes:
|
||||
_expect(node_name in sxcp_nodes.NODE_CLASS_MAPPINGS, f"{node_name} missing from node registry")
|
||||
_expect(node_name in sxcp_nodes.NODE_DISPLAY_NAME_MAPPINGS, f"{node_name} missing from display registry")
|
||||
|
||||
seed_control = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPSeedControl"]
|
||||
seed_inputs = seed_control.INPUT_TYPES().get("required") or {}
|
||||
_expect("category_seed_mode" in seed_inputs, "Seed Control lost category seed mode input")
|
||||
_expect("tooltip" in seed_inputs["category_seed_mode"][1], "Seed Control tooltip injection missing")
|
||||
|
||||
seed, seed_config, summary = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPGlobalSeed"]().build(12345)
|
||||
parsed_seed = json.loads(seed_config)
|
||||
_expect(seed == 12345, "Global Seed did not return the clamped seed")
|
||||
_expect(parsed_seed, "Global Seed config should not be empty")
|
||||
_expect(all(int(value) == 12345 for value in parsed_seed.values()), "Global Seed config did not lock every axis")
|
||||
_expect("all axes locked" in summary, "Global Seed summary changed unexpectedly")
|
||||
|
||||
locker_config, locker_summary = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPSeedLocker"]().build(12345, "pose", 999)
|
||||
parsed_locker = json.loads(locker_config)
|
||||
_expect(parsed_locker.get("pose_seed") == 999, "Seed Locker did not apply pose reroll seed")
|
||||
_expect("reroll pose" in locker_summary, "Seed Locker summary lost reroll axis")
|
||||
|
||||
bucket_node = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPSDXLBucketSize"]()
|
||||
bucket_a = bucket_node.build("portrait", 77, 3, 0)
|
||||
bucket_b = bucket_node.build("portrait", 77, 3, 0)
|
||||
_expect(bucket_a == bucket_b, "SDXL bucket should be deterministic for fixed seed and row")
|
||||
_expect(bucket_a[3] == "portrait", "SDXL bucket ignored orientation filter")
|
||||
|
||||
krea_node = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPKrea2ResolutionSelector"]()
|
||||
krea_width, krea_height, _resolution, aspect_ratio, api_aspect, _api_resolution, *_rest = krea_node.select("1.0MP", "9:16")
|
||||
krea_config = json.loads(_rest[-1])
|
||||
_expect(krea_height > krea_width, "Krea2 9:16 selector should return portrait dimensions")
|
||||
_expect(aspect_ratio == "9:16", "Krea2 selector lost requested aspect ratio")
|
||||
_expect(api_aspect == "9:16", "Krea2 selector lost API aspect mapping")
|
||||
_expect(krea_config.get("width") == krea_width and krea_config.get("height") == krea_height, "Krea2 config_json dimensions mismatch")
|
||||
|
||||
|
||||
SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("builtin_single_woman", smoke_builtin_single),
|
||||
("camera_scene_single", smoke_camera_scene_single),
|
||||
@@ -1684,6 +1729,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
|
||||
("fallback_role_graph_routes", smoke_fallback_role_graph_routes),
|
||||
("expression_disabled", smoke_no_expression_fallback),
|
||||
("formatter_metadata_fixtures", smoke_formatter_metadata_fixtures),
|
||||
("node_utility_registration", smoke_node_utility_registration),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user