CX_TEST(test_editor_load_markdown_simple) {
CX_TEST_DO {
- UiObject *obj = ui_simple_window("test1");
+ UiObject *obj = ui_simple_window("test");
CxAllocator *a = ui_allocator(obj->ctx);
Note note;
ui_close(obj);
}
}
+
+CX_TEST(test_editor_load_markdown_para1) {
+ CX_TEST_DO {
+ UiObject *obj = ui_simple_window("test");
+ CxAllocator *a = ui_allocator(obj->ctx);
+
+ Note note;
+ memset(¬e, 0, sizeof(Note));
+ note.model = notemodel_create(a);
+
+ UiText *text = note.model->text;
+ UIWIDGET textview = ui_textarea(obj, .value = text);
+
+ editor_init_textview(obj, ui_textarea_gettextwidget(textview));
+ editor_init_textbuf(text);
+
+ cxmutstr md0 = cx_mutstr("Hello World\n\nParagraph 2");
+
+ editor_load_markdown(¬e, textview, md0);
+ cxmutstr mdtext = editor_get_markdown(text, a);
+ CX_TEST_ASSERT(!cx_strcmp(cx_strtrim(mdtext), md0));
+
+ // TODO: cleanup
+ ui_close(obj);
+ }
+}
cx_test_register(suite, test_mddoc_linearization);
cx_test_register(suite, test_editor_load_markdown_simple);
+ cx_test_register(suite, test_editor_load_markdown_para1);
cx_test_register(suite, test_text_search_strcasestr);
cx_test_register(suite, test_text_search_cs);