[gedit/docstream2: 11/16] Added tests for text with multibyte sequences



commit cb3024a378c8168d30ba5bb51f808b15c820d2cd
Author: Jesse van den Kieboom <jesse icecrew nl>
Date:   Sat Jan 23 12:36:41 2010 +0100

    Added tests for text with multibyte sequences

 tests/document-input-stream.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/tests/document-input-stream.c b/tests/document-input-stream.c
index 8f6bfbe..0aeb2b9 100644
--- a/tests/document-input-stream.c
+++ b/tests/document-input-stream.c
@@ -102,6 +102,22 @@ test_consecutive_middle_read ()
 	test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 6);
 }
 
+static void
+test_consecutive_multibyte_cut ()
+{
+	test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 6);
+	test_consecutive_read ("hello\rhello\xe6\x96\x87\rworld\r", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 6);
+	test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\nhello\xe6\x96\x87\nworld\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 6);
+}
+
+static void
+test_consecutive_multibyte_big_read ()
+{
+	test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 200);
+	test_consecutive_read ("hello\rhello\xe6\x96\x87\rworld\r", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 200);
+	test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\nhello\xe6\x96\x87\nworld\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 200);
+}
+
 int main (int   argc,
           char *argv[])
 {
@@ -112,5 +128,8 @@ int main (int   argc,
 	g_test_add_func ("/document-input-stream/consecutive_big_read", test_consecutive_big_read);
 	g_test_add_func ("/document-input-stream/consecutive_middle_read", test_consecutive_middle_read);
 
+	g_test_add_func ("/document-input-stream/consecutive_multibyte_cut", test_consecutive_multibyte_cut);
+	g_test_add_func ("/document-input-stream/consecutive_multibyte_big_read", test_consecutive_multibyte_big_read);
+
 	return g_test_run ();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]