}
void init_tagtable(GtkTextTagTable *table) {
- printf("init_tagtable\n");
GtkTextTag *tag;
tag = gtk_text_tag_new(EDITOR_STYLE_PARAGRAPH);
#include "test-editor.h"
#include "../editor.h"
+#include "../note.h"
#include <cx/compare.h>
cxListFree(md.styles);
}
}
+
+CX_TEST(test_editor_load_markdown_simple) {
+ CX_TEST_DO {
+ UiObject *obj = ui_simple_window("test1");
+ 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, cx_mutstr("Hello World"));
+ cxmutstr mdtext = editor_get_markdown(text, a);
+ CX_TEST_ASSERT(!cx_strcmp(cx_strtrim(mdtext), "Hello World"));
+
+ // TODO: cleanup
+ ui_close(obj);
+ }
+}
CX_TEST(test_parse_markdown_list);
CX_TEST(test_mddoc_linearization);
+CX_TEST(test_editor_load_markdown_simple);
+
#ifdef __cplusplus
}
#endif
#include "test-note.h"
#include "../types.h"
+#include "../editor.h"
int main(int argc, char **argv) {
setlocale(LC_ALL, "de_DE.UTF-8");
ui_setappdir("notetestdata");
ui_init(NULL, 0, NULL);
register_types();
+ editor_global_init();
// required for testing async functions, that use ui_call_mainthread
ui_buffer_mainthread_calls(TRUE);
cx_test_register(suite, test_parse_markdown_list);
cx_test_register(suite, test_mddoc_linearization);
+ cx_test_register(suite, test_editor_load_markdown_simple);
+
cx_test_register(suite, test_text_search_strcasestr);
cx_test_register(suite, test_text_search_cs);
cx_test_register(suite, test_text_search_ci);