return para1 == NULL;
}
+CX_TEST_SUBROUTINE(test_editor_markdown_load_get, cxmutstr md0) {
+ 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);
+
+ editor_load_markdown(¬e, textview, md0);
+ cxmutstr mdtext = editor_get_markdown(text, a);
+ CX_TEST_ASSERT(md_equal(md0, mdtext));
+
+ // TODO: cleanup
+ 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(md_equal(md0, mdtext));
-
- // TODO: cleanup
- ui_close(obj);
+ CX_TEST_CALL_SUBROUTINE(test_editor_markdown_load_get, cx_mutstr("Hello World\n\nParagraph 2"));
+ }
+}
+
+CX_TEST(test_editor_load_markdown_heading_para) {
+ CX_TEST_DO {
+ CX_TEST_CALL_SUBROUTINE(test_editor_markdown_load_get, cx_mutstr("# Heading 1\n\nParagraph text\n\n## Heading 2\n\nText Paragraph 2\n"));
+ }
+}
+
+CX_TEST(test_editor_load_markdown_list1) {
+ CX_TEST_DO {
+ CX_TEST_CALL_SUBROUTINE(test_editor_markdown_load_get, cx_mutstr("Bullet list\n\n - Element 1\n - Element 2\n -n Element 3\n\nEnd."));
}
}
cx_test_register(suite, test_editor_load_markdown_simple);
cx_test_register(suite, test_editor_load_markdown_para1);
+ cx_test_register(suite, test_editor_load_markdown_heading_para);
+ cx_test_register(suite, test_editor_load_markdown_list1);
cx_test_register(suite, test_text_search_strcasestr);
cx_test_register(suite, test_text_search_cs);