22 lines
748 B
Python
22 lines
748 B
Python
import json
|
|
import unittest
|
|
|
|
import dumas_resolution_nodes as nodes
|
|
|
|
|
|
class DumasResolutionTests(unittest.TestCase):
|
|
def test_registers_dumas_resolution_node(self):
|
|
self.assertIn("DumasResolution", nodes.NODE_CLASS_MAPPINGS)
|
|
self.assertEqual(nodes.DumasResolutionNode.RETURN_NAMES, ("width", "height", "latent"))
|
|
self.assertIn("ResolutionState", nodes.DumasResolutionNode.INPUT_TYPES()["hidden"])
|
|
|
|
def test_resolution_state_is_clamped(self):
|
|
self.assertEqual(nodes.resolution_wh(json.dumps({"w": 32, "h": 20000})), (64, 16384))
|
|
|
|
def test_malformed_state_falls_back_to_default(self):
|
|
self.assertEqual(nodes.resolution_wh("not json"), (1024, 1024))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|