This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch edje-vector-intergration
in repository efl.
View the commit online.
commit aa537789dc951e7cac1a0b53e813b664fbbee89d
Author: [email protected] <[email protected]>
AuthorDate: Tue Apr 28 16:51:28 2026 -0600
edje: add level-1 vector-tree round-trip test (Task 3.0)
Close the Phase 2 review gate before Phase 3.1 lands runtime code. The
eina_hash key-semantics fixes in commit 447bff1054 (data_write_vectors_trees)
were validated by static reasoning only — this test exercises the full
parse → encode → decode pipeline.
New EDC fixture declares toplevel trees and groups that exercise both vector.use
and inline vector{} paths. Compiled to .edj at meson configure time. New
check-test (edje_vg_round_trip_tree_ids) loads via eet_data_read and asserts
trees are present and correctly structured.
This is a "Level 1" validation (trees exist, non-NULL CONTAINER roots). The
Level 2 check (per-description tree_id correctness) is deferred to Phase 3.2
where runtime rendering provides stronger end-to-end verification. Deferral
rationale: walking Edje_Part_Description_Vector structure requires either
private headers (lua.h unavailable) or partial-view structs that are fragile.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---
src/tests/edje/data/meson.build | 1 +
src/tests/edje/data/test_vector_states.edc | 41 ++++++++++
src/tests/edje/edje_test_vector_states.c | 124 +++++++++++++++++++++++++++++
3 files changed, 166 insertions(+)
diff --git a/src/tests/edje/data/meson.build b/src/tests/edje/data/meson.build
index c70f7755d5..7e0d1973d7 100644
--- a/src/tests/edje/data/meson.build
+++ b/src/tests/edje/data/meson.build
@@ -17,6 +17,7 @@ edc_files = [
'test_text_cursor.edc',
'test_textblock.edc',
'test_text.edc',
+ 'test_vector_states.edc',
]
themes = []
diff --git a/src/tests/edje/data/test_vector_states.edc b/src/tests/edje/data/test_vector_states.edc
new file mode 100644
index 0000000000..12a4b69bd7
--- /dev/null
+++ b/src/tests/edje/data/test_vector_states.edc
@@ -0,0 +1,41 @@
+collections {
+ vectors {
+ vector { name: "tile_a";
+ viewbox: 0 0 100 100;
+ shape { name: "body";
+ path: "M0,0 L100,0 L100,100 L0,100 Z";
+ fill.color: 200 0 0 255;
+ }
+ }
+ vector { name: "tile_b";
+ viewbox: 0 0 50 50;
+ shape { name: "body";
+ path: "M0,0 L50,50 L50,0 Z";
+ fill.color: 0 200 0 255;
+ }
+ }
+ }
+ group { name: "ui/box_a";
+ parts { part { name: "vg"; type: VECTOR;
+ description { state: "default" 0.0;
+ vector.use: "tile_a";
+ }
+ } }
+ }
+ group { name: "ui/box_b";
+ parts { part { name: "vg"; type: VECTOR;
+ description { state: "default" 0.0;
+ vector.use: "tile_b";
+ }
+ } }
+ }
+ group { name: "ui/box_c";
+ parts { part { name: "vg"; type: VECTOR;
+ description { state: "default" 0.0;
+ vector { viewbox: 0 0 25 25;
+ shape { name: "tiny"; path: "M0,0 L25,25"; fill.color: 0 0 200 255; }
+ }
+ }
+ } }
+ }
+}
diff --git a/src/tests/edje/edje_test_vector_states.c b/src/tests/edje/edje_test_vector_states.c
index 70a3ffcfe1..569b0f36e1 100644
--- a/src/tests/edje/edje_test_vector_states.c
+++ b/src/tests/edje/edje_test_vector_states.c
@@ -50,6 +50,66 @@ Edje_Vg_Node *_edje_vg_tree_node_by_name(const Edje_Vg_Tree *t,
Eina_Bool _edje_vg_tree_validate_unique_names(const Edje_Vg_Tree *t,
const char **dup_out);
+/*
+ * Partial-view forward declarations for the Task 3.0 round-trip test.
+ *
+ * We need to navigate from an Eet-decoded Edje_File blob to:
+ * 1. edf->vector_dir->trees_count (count of serialised trees)
+ * 2. edf->vector_dir->trees[i].root (each tree has a valid root container)
+ *
+ * For (1) and (2) we only need Edje_Vg_Directory and Edje_Vg_Tree, which
+ * are already declared above. The tree_id per-description verification is
+ * deferred to Phase 3.2 where end-to-end rendering provides an equivalent
+ * behavioural check.
+ *
+ * We declare Edje_File as an opaque struct and access vector_dir by casting
+ * the pointer returned by eet_data_read. This is safe because eet_data_read
+ * allocates and populates the real Edje_File; we only read fields at known
+ * offsets that are stable at the head of the struct.
+ *
+ * Layout of struct _Edje_File (edje_private.h, verified 2026-04-28):
+ * const char *path; // +0
+ * Edje_External_Directory *external_dir; // +1 ptr
+ * Edje_Image_Directory *image_dir; // +2 ptr
+ * Edje_Vg_Directory *vector_dir; // +3 ptr
+ *
+ * We provide a partial view struct containing exactly those four fields and
+ * access ONLY vector_dir through it.
+ */
+
+typedef struct _Edje_External_Directory Edje_External_Directory;
+typedef struct _Edje_Image_Directory Edje_Image_Directory;
+typedef struct _Edje_Vg_Directory Edje_Vg_Directory;
+
+/* Partial view: first four pointer fields of _Edje_File. DO NOT access any
+ * other fields. The tail of the real struct is opaque and may contain hashes,
+ * lists, and bitfields that are not mirrored here. */
+typedef struct
+{
+ const char *path;
+ Edje_External_Directory *external_dir;
+ Edje_Image_Directory *image_dir;
+ Edje_Vg_Directory *vector_dir;
+ /* opaque tail */
+} _Test_Edje_File_Head;
+
+/* Partial view for Edje_Vg_Directory: first two fields only.
+ * Layout (edje_private.h struct _Edje_Vg_Directory):
+ * Edje_Vg_Tree *trees; // pointer
+ * unsigned int trees_count; // 4 bytes
+ */
+struct _Edje_Vg_Directory
+{
+ Edje_Vg_Tree *trees;
+ unsigned int trees_count;
+ /* opaque tail (class_names, class_names_count) */
+};
+
+/* Eet descriptor symbols — initialised by edje_init() which the suite calls
+ * in SUITE_INIT(edje). Both are EAPI extern in edje_private.h. */
+EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
+EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
+
/*
* edje_vg_tree_eet_roundtrip
*
@@ -159,9 +219,73 @@ EFL_START_TEST(edje_vg_tree_helpers_basic)
}
EFL_END_TEST
+/*
+ * edje_vg_round_trip_tree_ids (Task 3.0)
+ *
+ * Verifies the end-to-end serializer path (Task 2.9) for a 3-tree fixture:
+ * - two named trees authored in the toplevel vectors{} block
+ * ("tile_a" → tree 0, "tile_b" → tree 1)
+ * - one inline anonymous tree inside ui/box_c's default description
+ * (tree 2)
+ *
+ * Level 1 checks (implemented here):
+ * a. edf->vector_dir is non-NULL.
+ * b. trees_count == 3.
+ * c. Each tree[i].root is non-NULL and is a CONTAINER node.
+ *
+ * Level 2 (per-description tree_id, deferred to Phase 3.2):
+ * Verifying that ui/box_a uses tree 0, ui/box_b uses tree 1, and ui/box_c
+ * uses tree 2 requires navigating into Edje_Part_Collection / Edje_Part /
+ * Edje_Part_Description_Vector structs. Those structs contain bitfields and
+ * embedded complex types that make safe partial-view access brittle.
+ * Phase 3.2's rendering integration will exercise the same invariant: if the
+ * wrong tree is fetched at runtime, the rendered content will be wrong, which
+ * is a stronger end-to-end signal.
+ */
+EFL_START_TEST(edje_vg_round_trip_tree_ids)
+{
+ const char *edj = TESTS_BUILD_DIR "/data/test_vector_states.edj";
+
+ /* edje_init() is called by the suite before each test. The descriptor
+ * _edje_edd_edje_file is initialised there. */
+ fail_if(_edje_edd_edje_file == NULL);
+
+ Eet_File *ef = eet_open(edj, EET_FILE_MODE_READ);
+ fail_if(!ef);
+
+ /* Decode the top-level file struct. The real allocation is an Edje_File;
+ * we access only the first four pointer fields via _Test_Edje_File_Head. */
+ _Test_Edje_File_Head *edf =
+ eet_data_read(ef, _edje_edd_edje_file, "edje/file");
+ fail_if(!edf);
+
+ /* Level 1a: vector directory must be present. */
+ fail_if(edf->vector_dir == NULL);
+
+ Edje_Vg_Directory *vd = edf->vector_dir;
+
+ /* Level 1b: fixture has exactly 3 trees. */
+ ck_assert_uint_eq(vd->trees_count, 3);
+
+ /* Level 1c: every tree must have a valid root container. */
+ for (unsigned int i = 0; i < vd->trees_count; i++)
+ {
+ Edje_Vg_Node *root = vd->trees[i].root;
+ fail_if(root == NULL);
+ ck_assert_int_eq(root->type, EDJE_VG_NODE_CONTAINER);
+ }
+
+ /* edf is a freshly-allocated Edje_File returned by eet_data_read. Freeing
+ * it properly requires edje-internal _edje_file_free() which is not
+ * accessible from tests. Leak intentionally — the process cleans up. */
+ eet_close(ef);
+}
+EFL_END_TEST
+
void
edje_test_vector_states(TCase *tc)
{
tcase_add_test(tc, edje_vg_tree_eet_roundtrip);
tcase_add_test(tc, edje_vg_tree_helpers_basic);
+ tcase_add_test(tc, edje_vg_round_trip_tree_ids);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.