[Aptitude-svn-commit] r3497 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Tue, 28 Jun 2005 00:54:16 +0000


Author: dburrows
Date: Tue Jun 28 00:54:14 2005
New Revision: 3497

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/testvscreen.cc
Log:
Add wide character strings to test the formatting code.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Jun 28 00:54:14 2005
@@ -1,5 +1,9 @@
 2005-06-27  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/testvscreen.cc:
+
+	  Add some actual wide characters to test the formatting code.
+
 	* src/vscreen/fragment.cc:
 
 	  Add a long string escape to fragf (for printing out stuff that's

Modified: branches/aptitude-0.3/aptitude/src/vscreen/testvscreen.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/testvscreen.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/testvscreen.cc	Tue Jun 28 00:54:14 2005
@@ -323,10 +323,8 @@
   l->set_text("");
 }
 
-// This isn't a very comprehensive test yet.
-vscreen_widget *make_layout_test()
+fragment *dickens_fragment()
 {
-  vs_table *t=new vs_table;
 
   vector<fragment*> v;
 
@@ -350,7 +348,38 @@
 
   v.push_back(hardwrapbox(fragf("The mention of Marley's funeral brings me back to the point I started from.  There is no doubt that Marley was dead.  This must be distinctly understood, or nothing wonderful can come of the story I am going to relate.  If we were not perfectly convinced that Hamlet's Father died before the play began, there would be nothing more remarkable in his taking a stroll at night, in an easterly wind, upon his own ramparts, than there would be in any other middle-aged gentleman rashly turning out after dark in a breezy spot -- say Saint Paul's Churchyard for instance -- literally to astonish his son's weak mind.")));
 
-  vs_text_layout *l=new vs_text_layout(sequence_fragment(v));
+  return sequence_fragment(v);
+}
+
+// test wrapping around utf8.
+fragment *chinese_fragment()
+{
+  vector<fragment *> v;
+
+  v.push_back(clipbox(fragf("Here is some Chinese text:%n%n%ls", L"\u6211\u7684\u6c23\u588a\u8239\u5145\u6eff\u4e86\u9c54\u9b5a")));
+
+  v.push_back(newline_fragment());
+
+  v.push_back(flowbox(fragf("Here is some Chinese text:%n%n%ls", L"\u6211\u7684\u6c23\u588a\u8239\u5145\u6eff\u4e86\u9c54\u9b5a")));
+
+  v.push_back(newline_fragment());
+
+  v.push_back(hardwrapbox(fragf("Here is some Chinese text:%n%n%ls", L"\u6211\u7684\u6c23\u588a\u8239\u5145\u6eff\u4e86\u9c54\u9b5a")));
+
+  v.push_back(newline_fragment());
+
+  v.push_back(fillbox(fragf("Here is some Chinese text:%n%n%ls", L"\u6211\u7684\u6c23\u588a\u8239\u5145\u6eff\u4e86\u9c54\u9b5a")));
+
+  return sequence_fragment(v);
+}
+
+// This isn't a very comprehensive test yet.
+vscreen_widget *make_layout_test(fragment *f)
+{
+  vs_table *t=new vs_table;
+
+
+  vs_text_layout *l=new vs_text_layout(f);
   vs_scrollbar *s=new vs_scrollbar(vs_scrollbar::VERTICAL);
   l->location_changed.connect(sigc::mem_fun(*s, &vs_scrollbar::set_slider));
   s->scrollbar_interaction.connect(sigc::mem_fun(*l, &vs_text_layout::scroll));
@@ -443,7 +472,8 @@
   table->show_all();
   switcher->add_widget(table);
 
-  switcher->add_visible_widget(make_layout_test(), true);
+  switcher->add_visible_widget(make_layout_test(chinese_fragment()), true);
+  switcher->add_visible_widget(make_layout_test(dickens_fragment()), true);
 
   stacker->add_visible_widget(switcher, true);