Readable value names for all Intelligent types; TextSelect lines follow dis
Value lists read from the Editor's attribute notes with an Intelligent model: drag, load effect (page has two more), transparency background, switch direction, ComboBox arrow/expansion, TextSelect lines, scroll bars, DataRecord options, media source/state/looping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
49fee337d7
commit
6616b47cb4
5 files changed
+61
-5
No files matched your search
@@ -27,6 +27,27 @@ class Enums(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
enums.from_label(116, "xcen", "u8", "sideways")
|
||||
|
||||
def test_intelligent_types(self):
|
||||
# value lists from the Editor's attribute notes (Intelligent model)
|
||||
self.assertEqual(enums.to_label(67, "dez", "u8", 1), "vertical") # switch
|
||||
self.assertEqual(enums.to_label(61, "dir", "u8", 1), "down") # combobox
|
||||
self.assertEqual(enums.to_label(68, "sta", "u8", 3), "transparency") # text select
|
||||
self.assertEqual(enums.to_label(66, "order", "u8", 0), "new data before") # data record
|
||||
self.assertEqual(enums.to_label(3, "en", "u8", 2), "pause") # video
|
||||
self.assertEqual(enums.to_label(121, "effect", "u8", 10), "middle zoom in") # page only
|
||||
self.assertEqual(enums.to_label(116, "effect", "u8", 10), 10)
|
||||
self.assertEqual(enums.from_label(65, "psta", "u8", "yes"), 1) # file browser
|
||||
|
||||
def test_every_type_has_names(self):
|
||||
import json, os
|
||||
from nxhmi import components
|
||||
here = os.path.dirname(components.__file__)
|
||||
types = json.load(open(os.path.join(here, "templates_intelligent.json"), encoding="utf-8"))["types"]
|
||||
for t, spec in types.items():
|
||||
names = {a[0] for a in spec["att"]}
|
||||
labelled = [a for a in names if enums.table(int(t), a)]
|
||||
self.assertTrue(labelled, spec["kind"]) # vscope at least
|
||||
|
||||
def test_strings_untouched(self):
|
||||
self.assertEqual(enums.to_label(116, "txt", "str", "#abc"), "#abc")
|
||||
|
||||
|
||||
Reference in new issue
Block a user