diff --git a/tests/test_files/group.xml b/tests/test_files/group.xml
index 629acc1..9027317 100644
--- a/tests/test_files/group.xml
+++ b/tests/test_files/group.xml
@@ -4,61 +4,29 @@
0
0
255
- 620
-
- pmac.autohome
- 205
- 120
- ../../techui-support/bob/motor_embed.bob
-
- BL01T-MO-MAP-01:STAGE
-
-
- 0
- 0
-
+ 320
X
205
120
- ../../techui-support/bob/motor_embed.bob
+ src/techui_support/bob/pmac/motor_embed.bob
BL01T-MO-MAP-01:STAGE
X
0
- 150
+ 0
A
205
120
- ../../techui-support/bob/motor_embed.bob
+ src/techui_support/bob/pmac/motor_embed.bob
BL01T-MO-MAP-01:STAGE
A
0
- 300
-
-
- pmac.GeoBrick
- 100
- 40
- BL01T-MO-BRICK-01:None
- BL01T-MO-BRICK-01
-
-
- Open Display
-
- BL01T-MO-BRICK-01
- None
-
- ../../techui-support/bob/pmacController.bob
- tab
-
-
- 0
- 450
+ 150
diff --git a/tests/test_files/screen.bob b/tests/test_files/screen.bob
new file mode 100644
index 0000000..cbad590
--- /dev/null
+++ b/tests/test_files/screen.bob
@@ -0,0 +1,35 @@
+
+
+ motor
+
+ motor
+ 0
+ 0
+ 255
+ 320
+
+ X
+ 205
+ 120
+ src/techui_support/bob/pmac/motor_embed.bob
+
+ BL01T-MO-MAP-01:STAGE
+ X
+
+ 0
+ 0
+
+
+ A
+ 205
+ 120
+ src/techui_support/bob/pmac/motor_embed.bob
+
+ BL01T-MO-MAP-01:STAGE
+ A
+
+ 0
+ 150
+
+
+
diff --git a/tests/test_files/widget.xml b/tests/test_files/widget.xml
new file mode 100644
index 0000000..e097177
--- /dev/null
+++ b/tests/test_files/widget.xml
@@ -0,0 +1,13 @@
+
+
+ X
+ 0
+ 0
+ 205
+ 120
+ src/techui_support/bob/pmac/motor_embed.bob
+
+ BL01T-MO-MAP-01:STAGE
+ X
+
+
diff --git a/tests/test_generate.py b/tests/test_generate.py
index 44e6d50..d891a6f 100644
--- a/tests/test_generate.py
+++ b/tests/test_generate.py
@@ -3,26 +3,43 @@
import pytest
from techui_builder.builder import Builder
-
-# from techui_builder.generate import Generator
+from techui_builder.generate import Generator
@pytest.fixture
-def gb():
- b = Builder(Path("example/create_gui.yaml)"))
+def gen():
+ b = Builder(Path("example/create_gui.yaml"))
b._services_dir = Path(f"./example/{b.beamline.dom}-services")
b._write_directory = Path("example/")
b._extract_entities(
ioc_yaml=Path(f"{b._services_dir}/services/bl01t-mo-ioc-01/config/ioc.yaml"),
) # TODO: Change from hardcoded index
- return b
+ gen = Generator(
+ b.entities["BL01T-MO-MAP-01:STAGE"], b.components[4].name, Path("./")
+ )
+ return gen
+
+
+def test_create_widget(gen: Generator):
+ with open("./tests/test_files/widget.xml") as f:
+ control = f.read()
+ assert str(gen._create_widget(gen.screen_components[1])) == control
+
+
+def test_write_screen(gen: Generator):
+ gen.build_groups()
+ gen.write_screen(Path("./"))
+ with open("./motor.bob") as f:
+ expected = f.read()
+
+ with open("./tests/test_files/screen.bob") as f:
+ control = f.read()
+
+ assert expected == control
-# def test_build_groups(gb: Builder):
-# generator = Generator(
-# gb.entities, gb._gui_map, gb.components[4].name
-# ) # TODO: remove hardcoded index
-# generator.build_groups()
-# with open("./tests/test_files/group.xml") as f:
-# control = f.read()
-# assert str(generator.group) == control
+def test_build_groups(gen: Generator):
+ gen.build_groups()
+ with open("./tests/test_files/group.xml") as f:
+ control = f.read()
+ assert str(gen.group) == control