]> uap-core.de Git - note.git/commitdiff
add test_note_store_get_notebook_by_id main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 15 Jan 2026 18:15:56 +0000 (19:15 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 15 Jan 2026 18:15:56 +0000 (19:15 +0100)
application/tests/test-store.c
application/tests/test-store.h
application/tests/testmain.c

index 2fd663d021bf75b069862a86cffdefd4b2d277c3..f2e4faea5be513cf52e77c69ccca2ffd54a2df14 100644 (file)
@@ -270,3 +270,21 @@ CX_TEST(test_note_store_save_resource_async) {
         ui_close(obj);
     }
 }
+
+CX_TEST(test_note_store_get_notebook_by_id) {
+    // it is important that this test is run after some other tests
+    // created some resources
+    CX_TEST_DO {
+        CX_TEST_ASSERT(!note_store_reload());
+        NoteStore *store = note_store_get();
+        CX_TEST_ASSERT(store && store->root && store->root->children);
+        CX_TEST_ASSERT(cxListSize(store->root->children) > 0);
+        
+        CxIterator i = cxListIterator(store->root->children);
+        cx_foreach(Resource *, res, i) {
+            Resource *xres = note_store_get_notebook_by_id(res->resource_id);
+            CX_TEST_ASSERT(res == xres);
+        }
+    }
+}
+
index ed281ce566371ccf13b444ba3af141af6a9c5839..0e12cdd8f5b537ee82bd99dec18b7eb33b58dba8 100644 (file)
@@ -39,6 +39,7 @@ CX_TEST(test_init_note_store);
 CX_TEST(test_note_store_create_default);
 CX_TEST(test_user_settings_is_valid);
 
+CX_TEST(test_note_store_get_notebook_by_id);
 CX_TEST(test_note_store_reload);
 CX_TEST(test_note_store_new_resource_async);
 CX_TEST(test_note_store_new_notebook_async);
index 59a68aea4e1f041542d10a7424468f2720b78c5b..de17487c02a4aac306e630a78f35f8e4a7b497c4 100644 (file)
@@ -60,6 +60,7 @@ int main(int argc, char **argv) {
     cx_test_register(suite, test_note_store_new_resource_async);
     cx_test_register(suite, test_note_store_new_notebook_async);
     cx_test_register(suite, test_note_store_save_resource_async);
+    cx_test_register(suite, test_note_store_get_notebook_by_id);
     
     cx_test_register(suite, test_parse_markdown_para);
     cx_test_register(suite, test_parse_markdown_formatting_simple);