ui_close(obj);
}
}
+
+static void test_new_notebook_result(UiEvent *event, int64_t newid, int error, void *userdata) {
+ int64_t *ptr = userdata;
+ ptr[0] = newid;
+ ptr[1] = error;
+}
+
+CX_TEST(test_note_store_new_notebook_async) {
+ CX_TEST_DO {
+ UiObject *obj = ui_dummy_object();
+
+ NoteStore *store = note_store_get();
+ CX_TEST_ASSERT(store);
+
+ Resource res0 = { 0 };
+ res0.nodename = "note_store_new_notebook_async";
+ res0.parent_id = store->root->resource_id;
+ res0.iscollection = TRUE;
+
+ int64_t result[2] = { 0, -1 };
+ note_store_new_notebook_async(obj, &res0, test_new_notebook_result, result);
+ ui_exec_buffered_mainthread_calls_wait(3);
+
+ CX_TEST_ASSERT(result[0] > 0);
+ CX_TEST_ASSERT(result[1] == 0);
+
+ CX_TEST_ASSERT(!note_store_reload());
+ store = note_store_get();
+
+ CX_TEST_ASSERT(store && store->root && store->root->children);
+ int res_found = 0;
+ CxIterator i = cxListIterator(store->root->children);
+ cx_foreach(Resource *, resource, i) {
+ if(!cx_strcmp(resource->nodename, res0.nodename)) {
+ res_found = 1;
+ break;
+ }
+ }
+ CX_TEST_ASSERT(res_found);
+
+ ui_close(obj);
+ }
+}
cx_test_register(suite, test_user_settings_is_valid);
cx_test_register(suite, test_note_store_reload);
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_parse_markdown_para);
cx_test_register(suite, test_parse_markdown_formatting_simple);