@@ -33,6 +33,30 @@ TEST(Document, odt) {
3333 EXPECT_EQ (Measure (" 0.7874in" ), page_layout.margin .top );
3434}
3535
36+ TEST (Document, odt_element_path) {
37+ const auto logger = Logger::create_stdio (" odr-test" , LogLevel::verbose);
38+
39+ const DocumentFile document_file (
40+ TestData::test_file_path (" odr-public/odt/about.odt" ), *logger);
41+
42+ EXPECT_EQ (document_file.file_type (), FileType::opendocument_text);
43+
44+ const Document document = document_file.document ();
45+
46+ EXPECT_EQ (document.document_type (), DocumentType::text);
47+
48+ const auto root = document.root_element ();
49+ const auto p1 = root.first_child ();
50+ EXPECT_EQ (p1.type (), ElementType::paragraph);
51+ const auto t1 = p1.first_child ();
52+ EXPECT_EQ (t1.type (), ElementType::text);
53+
54+ const DocumentPath t1_path = DocumentPath::extract (t1, root);
55+ EXPECT_EQ (t1_path.to_string (), " /child:0/child:0" );
56+ const Element t1_via_path = DocumentPath::find (root, t1_path);
57+ EXPECT_EQ (t1_via_path, t1);
58+ }
59+
3660TEST (Document, odg) {
3761 auto logger = Logger::create_stdio (" odr-test" , LogLevel::verbose);
3862
0 commit comments