summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2019-03-27 10:18:41 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-03-27 10:58:35 -0400
commit0f29560aa2214f1fb28a601212242c58524f85a3 (patch)
treebea51411a3efb088e564b7184fc0ba45ce2fd339 /src/tests
parent8e8aa74751fa9d2ff450acd789d0fdd22ab72171 (diff)
test: add a test case for elm_entry
Summary: behaviors of elm_entry has been changed so that this patch provides usages to keep as a test case. Reviewers: zmike, Hermet, YOhoho Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8483
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/elm_test_entry.c39
-rw-r--r--src/tests/elementary/testfile_entry.txt1
-rw-r--r--src/tests/elementary/testfile_entry2.txt2
3 files changed, 42 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_entry.c b/src/tests/elementary/elm_test_entry.c
index 5033798f7d..48e31d0b3c 100644
--- a/src/tests/elementary/elm_test_entry.c
+++ b/src/tests/elementary/elm_test_entry.c
@@ -491,6 +491,44 @@ EFL_START_TEST(elm_entry_text_set)
491} 491}
492EFL_END_TEST 492EFL_END_TEST
493 493
494EFL_START_TEST(elm_entry_file_get_set)
495{
496 Evas_Object *win, *entry;
497 const char *file_path = NULL;
498 Elm_Text_Format format = ELM_TEXT_FORMAT_PLAIN_UTF8;
499
500 win = win_add(NULL, "entry", ELM_WIN_BASIC);
501 entry = elm_entry_add(win);
502
503 ck_assert(elm_entry_file_set(entry, TESTS_SRC_DIR"/testfile_entry.txt", ELM_TEXT_FORMAT_PLAIN_UTF8));
504 elm_entry_file_get(entry, &file_path, &format);
505 fprintf(stderr, "elm_entry_file_get_set1 %s, %s, %d\n", elm_object_text_get(entry), file_path, format);
506
507 ck_assert_str_eq(elm_object_text_get(entry), "hello world<br/>");
508 ck_assert_str_eq(file_path, TESTS_SRC_DIR"/testfile_entry.txt");
509 ck_assert(format == ELM_TEXT_FORMAT_PLAIN_UTF8);
510
511 ck_assert(elm_entry_file_set(entry, TESTS_SRC_DIR"/testfile_entry2.txt", ELM_TEXT_FORMAT_PLAIN_UTF8));
512 elm_entry_file_get(entry, &file_path, &format);
513 fprintf(stderr, "elm_entry_file_get_set2 %s, %s, %d\n", elm_object_text_get(entry), file_path, format);
514
515 ck_assert_str_eq(elm_object_text_get(entry), "hello elementary<br/>hello entry<br/>");
516 ck_assert_str_eq(file_path, TESTS_SRC_DIR"/testfile_entry2.txt");
517 ck_assert(format == ELM_TEXT_FORMAT_PLAIN_UTF8);
518
519 ck_assert(elm_entry_file_set(entry, NULL, ELM_TEXT_FORMAT_PLAIN_UTF8));
520 elm_entry_file_get(entry, &file_path, &format);
521 fprintf(stderr, "elm_entry_file_get_set3 %s, %s, %d\n", elm_object_text_get(entry), file_path, format);
522
523 ck_assert_str_eq(elm_object_text_get(entry), "");
524 ck_assert(file_path == NULL);
525 ck_assert(format == ELM_TEXT_FORMAT_PLAIN_UTF8);
526
527 fprintf(stderr, "elm_entry_file_get_set4\n");
528
529}
530EFL_END_TEST
531
494void elm_test_entry(TCase *tc) 532void elm_test_entry(TCase *tc)
495{ 533{
496 tcase_add_test(tc, elm_entry_legacy_type_check); 534 tcase_add_test(tc, elm_entry_legacy_type_check);
@@ -507,4 +545,5 @@ void elm_test_entry(TCase *tc)
507 tcase_add_test(tc, elm_atspi_role_get); 545 tcase_add_test(tc, elm_atspi_role_get);
508 tcase_add_test(tc, elm_entry_text_set); 546 tcase_add_test(tc, elm_entry_text_set);
509 tcase_add_test(tc, elm_entry_magnifier); 547 tcase_add_test(tc, elm_entry_magnifier);
548 tcase_add_test(tc, elm_entry_file_get_set);
510} 549}
diff --git a/src/tests/elementary/testfile_entry.txt b/src/tests/elementary/testfile_entry.txt
new file mode 100644
index 0000000000..3b18e512db
--- /dev/null
+++ b/src/tests/elementary/testfile_entry.txt
@@ -0,0 +1 @@
hello world
diff --git a/src/tests/elementary/testfile_entry2.txt b/src/tests/elementary/testfile_entry2.txt
new file mode 100644
index 0000000000..4b870a2e68
--- /dev/null
+++ b/src/tests/elementary/testfile_entry2.txt
@@ -0,0 +1,2 @@
1hello elementary
2hello entry