浏览代码

Fixes unit tests according to the changes.

BDisp 3 年之前
父节点
当前提交
4392f450da
共有 6 个文件被更改,包括 383 次插入92 次删除
  1. 3 3
      UnitTests/ComboBoxTests.cs
  2. 15 15
      UnitTests/ContextMenuTests.cs
  3. 35 35
      UnitTests/MenuTests.cs
  4. 4 4
      UnitTests/PosTests.cs
  5. 4 4
      UnitTests/TextFormatterTests.cs
  6. 322 31
      UnitTests/ViewTests.cs

+ 3 - 3
UnitTests/ComboBoxTests.cs

@@ -122,7 +122,7 @@ namespace Terminal.Gui.Views {
 			Application.Begin (Application.Top);
 			GraphViewTests.AssertDriverContentsWithFrameAre (@"
 One      ▼
-One
+One       
 ", output);
 
 			Assert.True (cb.ProcessKey (new KeyEvent (Key.PageDown, new KeyModifiers ())));
@@ -132,7 +132,7 @@ One
 			Application.Begin (Application.Top);
 			GraphViewTests.AssertDriverContentsWithFrameAre (@"
 Two      ▼
-Two
+Two       
 ", output);
 
 			Assert.True (cb.ProcessKey (new KeyEvent (Key.PageDown, new KeyModifiers ())));
@@ -142,7 +142,7 @@ Two
 			Application.Begin (Application.Top);
 			GraphViewTests.AssertDriverContentsWithFrameAre (@"
 Three    ▼
-Three
+Three     
 ", output);
 			Assert.True (cb.ProcessKey (new KeyEvent (Key.PageUp, new KeyModifiers ())));
 			Assert.True (cb.IsShow);

+ 15 - 15
UnitTests/ContextMenuTests.cs

@@ -309,7 +309,7 @@ namespace Terminal.Gui.Core {
                                                                       │ One  │
                                                                       │ Two  │
                                                                       └──────┘
-                                                                      View
+                                                                      View    
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -340,7 +340,7 @@ namespace Terminal.Gui.Core {
 			Assert.Equal (new Point (10, 5), cm.Position);
 
 			var expected = @"
-          View
+          View    
           ┌──────┐
           │ One  │
           │ Two  │
@@ -361,9 +361,9 @@ namespace Terminal.Gui.Core {
 			Assert.Equal (new Point (5, 12), cm.Position);
 
 			expected = @"
-     View
-
-
+     View    
+             
+             
      ┌──────┐
      │ One  │
      │ Two  │
@@ -592,10 +592,10 @@ namespace Terminal.Gui.Core {
 			Assert.Equal (new Point (9, 3), tf.ContextMenu.Position);
 			Application.Top.Redraw (Application.Top.Bounds);
 			var expected = @"
-  File   Edit
-
-
-  Label: TextField
+  File   Edit                         
+                                      
+                                      
+  Label: TextField                    
          ┌───────────────────────────┐
          │ Select All         Ctrl+T │
          │ Delete All   Ctrl+Shift+D │
@@ -605,10 +605,10 @@ namespace Terminal.Gui.Core {
          │ Undo               Ctrl+Z │
          │ Redo               Ctrl+Y │
          └───────────────────────────┘
-
-
-
- F1 Help │ ^Q Quit
+                                      
+                                      
+                                      
+ F1 Help │ ^Q Quit                    
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -657,7 +657,7 @@ namespace Terminal.Gui.Core {
 			Assert.Equal (new Point (10, 5), tf.ContextMenu.Position);
 			Application.Top.Redraw (Application.Top.Bounds);
 			var expected = @"
-  File   Edit
+  File   Edit                               
 ┌ Window ──────────────────────────────────┐
 │                                          │
 │                                          │
@@ -673,7 +673,7 @@ namespace Terminal.Gui.Core {
 │         │ Redo               Ctrl+Y │    │
 │         └───────────────────────────┘    │
 └──────────────────────────────────────────┘
- F1 Help │ ^Q Quit
+ F1 Help │ ^Q Quit                          
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);

+ 35 - 35
UnitTests/MenuTests.cs

@@ -660,8 +660,8 @@ Edit
 
 			expected = @"
 ┌──────
-│ One
-│ Two
+│ One  
+│ Two  
 └──────
 ";
 
@@ -676,8 +676,8 @@ Edit
 
 			expected = @"
 ┌──────
-│ One
-│ Two
+│ One  
+│ Two  
 ";
 
 			pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -714,7 +714,7 @@ Edit
 			Assert.True (menu.ProcessHotKey (new KeyEvent (Key.F9, null)));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -728,9 +728,9 @@ Edit
 			Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.CursorDown, null)));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
-┌────────┐
-│ One    │
+  Numbers                
+┌────────┐               
+│ One    │               
 │ Two   ►│┌─────────────┐
 │ Three  ││ Sub-Menu 1  │
 └────────┘│ Sub-Menu 2  │
@@ -743,7 +743,7 @@ Edit
 			Assert.True (Application.Top.Subviews [2].ProcessKey (new KeyEvent (Key.CursorLeft, null)));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -799,7 +799,7 @@ Edit
 			}));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -818,9 +818,9 @@ Edit
 			}));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
-┌────────┐
-│ One    │
+  Numbers                
+┌────────┐               
+│ One    │               
 │ Two   ►│┌─────────────┐
 │ Three  ││ Sub-Menu 1  │
 └────────┘│ Sub-Menu 2  │
@@ -838,7 +838,7 @@ Edit
 			}));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -896,7 +896,7 @@ Edit
 			Assert.True (menu.ProcessHotKey (new KeyEvent (Key.F9, null)));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -911,7 +911,7 @@ Edit
 			Assert.True (Application.Top.Subviews [1].ProcessKey (new KeyEvent (Key.Enter, null)));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers      
 ┌─────────────┐
 │◄    Two     │
 ├─────────────┤
@@ -926,7 +926,7 @@ Edit
 			Assert.True (Application.Top.Subviews [2].ProcessKey (new KeyEvent (Key.Enter, null)));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -984,7 +984,7 @@ Edit
 			}));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -1003,7 +1003,7 @@ Edit
 			}));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers      
 ┌─────────────┐
 │◄    Two     │
 ├─────────────┤
@@ -1023,7 +1023,7 @@ Edit
 			}));
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  Numbers
+  Numbers 
 ┌────────┐
 │ One    │
 │ Two   ►│
@@ -1125,9 +1125,9 @@ Edit
 			Application.Top.Redraw (Application.Top.Bounds);
 			var expected = @"
   File   Edit
-┌──────┐
-│ New  │
-└──────┘
+┌──────┐     
+│ New  │     
+└──────┘     
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -1141,7 +1141,7 @@ Edit
 			Assert.True (menu.IsMenuOpen);
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  File   Edit
+  File   Edit   
        ┌───────┐
        │ Copy  │
        └───────┘
@@ -1175,9 +1175,9 @@ Edit
 			Application.Top.Redraw (Application.Top.Bounds);
 			var expected = @"
   File   Edit
-┌──────┐
-│ New  │
-└──────┘
+┌──────┐     
+│ New  │     
+└──────┘     
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -1187,7 +1187,7 @@ Edit
 			Assert.True (menu.IsMenuOpen);
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  File   Edit
+  File   Edit   
        ┌───────┐
        │ Copy  │
        └───────┘
@@ -1221,9 +1221,9 @@ Edit
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
   File   Edit
-┌──────┐
-│ New  │
-└──────┘
+┌──────┐     
+│ New  │     
+└──────┘     
 ";
 
 			pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -1233,7 +1233,7 @@ Edit
 			Assert.True (menu.IsMenuOpen);
 			Application.Top.Redraw (Application.Top.Bounds);
 			expected = @"
-  File   Edit
+  File   Edit   
        ┌───────┐
        │ Copy  │
        └───────┘
@@ -1262,9 +1262,9 @@ Edit
 			Application.Top.Redraw (Application.Top.Bounds);
 			var expected = @"
   File   Edit
-┌──────┐
-│ New  │
-└──────┘
+┌──────┐     
+│ New  │     
+└──────┘     
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);

+ 4 - 4
UnitTests/PosTests.cs

@@ -247,7 +247,7 @@ namespace Terminal.Gui.Core {
 				win.Frame.Right, win.Frame.Bottom));
 			Assert.Equal (new Rect (0, 20, 78, 1), label.Frame);
 			var expected = @"
-  Menu
+  Menu                                                                          
 ┌──────────────────────────────────────────────────────────────────────────────┐
 │                                                                              │
 │                                                                              │
@@ -271,7 +271,7 @@ namespace Terminal.Gui.Core {
 │                                                                              │
 │                        This should be the last line.                         │
 └──────────────────────────────────────────────────────────────────────────────┘
- F1 Help
+ F1 Help                                                                        
 ";
 
 			GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -310,7 +310,7 @@ namespace Terminal.Gui.Core {
 				win.Frame.Right, win.Frame.Bottom));
 			Assert.Equal (new Rect (0, 20, 78, 1), label.Frame);
 			var expected = @"
-  Menu
+  Menu                                                                          
 ┌──────────────────────────────────────────────────────────────────────────────┐
 │                                                                              │
 │                                                                              │
@@ -334,7 +334,7 @@ namespace Terminal.Gui.Core {
 │                                                                              │
 │                        This should be the last line.                         │
 └──────────────────────────────────────────────────────────────────────────────┘
- F1 Help
+ F1 Help                                                                        
 ";
 
 			GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);

+ 4 - 4
UnitTests/TextFormatterTests.cs

@@ -2260,8 +2260,8 @@ namespace Terminal.Gui.Core {
 			var height = 4;
 			var wrappedLines = TextFormatter.WordWrap (text, width, true);
 			var breakLines = "";
-			foreach (var line in wrappedLines) {
-				breakLines += $"{line}{Environment.NewLine}";
+			for (int i = 0; i < wrappedLines.Count; i++) {
+				breakLines += $"{wrappedLines [i]}{(i < wrappedLines.Count - 1 ? Environment.NewLine : string.Empty)}";
 			}
 			var label = new Label (breakLines) {
 				TextDirection = TextDirection.TopBottom_LeftRight,
@@ -3016,14 +3016,14 @@ D
 e
 m
 o
-
+ 
 S
 i
 m
 p
 l
 e
-
+ 
 R
 u
 n

+ 322 - 31
UnitTests/ViewTests.cs

@@ -1500,8 +1500,8 @@ namespace Terminal.Gui.Core {
 
 			var expected = @"
 Hello     X
-
-Y
+           
+Y          
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -1515,8 +1515,8 @@ Y
 
 			expected = @"
 Hello     X
-
-Y
+           
+Y          
 ";
 
 			pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -1538,16 +1538,16 @@ Y
 
 			var expected = @"
 H X
-e
-l
-l
-o
-
-
-
-
-
-Y
+e  
+l  
+l  
+o  
+   
+   
+   
+   
+   
+Y  
 ";
 
 			var pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -1561,16 +1561,16 @@ Y
 
 			expected = @"
 H X
-e
-l
-l
-o
-
-
-
-
-
-Y
+e  
+l  
+l  
+o  
+   
+   
+   
+   
+   
+Y  
 ";
 
 			pos = GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
@@ -2163,8 +2163,8 @@ Y
 
 			expected = @"
 ┌──────
-│
-│
+│      
+│      
 └──────
 ";
 
@@ -2173,7 +2173,6 @@ Y
 
 			view.Frame = new Rect (0, 0, 8, 4);
 			((FakeDriver)Application.Driver).SetBufferSize (7, 3);
-
 		}
 
 		[Fact, AutoInitShutdown]
@@ -3439,7 +3438,7 @@ Y
 		}
 
 		[Fact]
-		public void AutoSize_Layout_Absolute_Without_Add ()
+		public void AutoSize_Layout_Absolute_Without_Add_Horizontal_Narrow ()
 		{
 			var view = new View (new Rect (0, 0, 10, 1)) {
 				Text = "Test"
@@ -3467,7 +3466,7 @@ Y
 		}
 
 		[Fact, AutoInitShutdown]
-		public void AutoSize_Layout_Absolute_With_Add ()
+		public void AutoSize_Layout_Absolute_With_Add_Horizontal_Narrow ()
 		{
 			var view = new View (new Rect (0, 0, 10, 1)) {
 				Text = "Test"
@@ -3483,7 +3482,6 @@ Y
 Test
 ", output);
 
-
 			view.Text = "First line\nSecond line";
 			Assert.False (view.AutoSize);
 			Assert.Equal (new Rect (0, 0, 10, 1), view.Frame);
@@ -3499,7 +3497,7 @@ First line
 			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
 			Application.Refresh ();
 			GraphViewTests.AssertDriverContentsWithFrameAre (@"
-First line
+First line 
 Second line
 ", output);
 
@@ -3512,5 +3510,298 @@ Second line
 First line
 ", output);
 		}
+
+		[Fact]
+		public void AutoSize_Layout_Absolute_Without_Add_Vertical_Narrow ()
+		{
+			var view = new View (new Rect (0, 0, 1, 10)) {
+				Text = "Test",
+				TextDirection = TextDirection.TopBottom_LeftRight
+			};
+
+			Assert.False (view.IsAdded);
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 1, 10), view.Frame);
+			Assert.Equal ("Test", view.TextFormatter.Text);
+
+			view.Text = "First line\nSecond line";
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 1, 10), view.Frame);
+			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
+
+			view.AutoSize = true;
+			Assert.True (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 2, 11), view.Frame);
+			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
+
+			view.AutoSize = false;
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 2, 11), view.Frame);
+			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
+		}
+
+		[Fact, AutoInitShutdown]
+		public void AutoSize_Layout_Absolute_With_Add_Vertical_Narrow ()
+		{
+			var view = new View (new Rect (0, 0, 1, 10)) {
+				Text = "Test",
+				TextDirection = TextDirection.TopBottom_LeftRight
+			};
+			Application.Top.Add (view);
+			Application.Begin (Application.Top);
+
+			Assert.True (view.IsAdded);
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 1, 10), view.Frame);
+			Assert.Equal ("Test", view.TextFormatter.Text);
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+T
+e
+s
+t
+", output);
+
+			view.Text = "First line\nSecond line";
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 1, 10), view.Frame);
+			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+F
+i
+r
+s
+t
+ 
+l
+i
+n
+e
+", output);
+
+			view.AutoSize = true;
+			Assert.True (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 2, 11), view.Frame);
+			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+FS
+ie
+rc
+so
+tn
+ d
+l 
+il
+ni
+en
+ e
+", output);
+
+			view.AutoSize = false;
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 1, 10), view.Frame);
+			Assert.Equal ("First line\nSecond line", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+F
+i
+r
+s
+t
+ 
+l
+i
+n
+e
+", output);
+		}
+
+		[Fact]
+		public void AutoSize_Layout_Absolute_Without_Add_Horizontal_Wide ()
+		{
+			var view = new View (new Rect (0, 0, 10, 1)) {
+				Text = "Test 你"
+			};
+
+			Assert.False (view.IsAdded);
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 10, 1), view.Frame);
+			Assert.Equal ("Test 你", view.TextFormatter.Text);
+
+			view.Text = "First line 你\nSecond line 你";
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 10, 1), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+
+			view.AutoSize = true;
+			Assert.True (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 14, 2), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+
+			view.AutoSize = false;
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 14, 2), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+		}
+
+		[Fact, AutoInitShutdown]
+		public void AutoSize_Layout_Absolute_With_Add_Horizontal_Wide ()
+		{
+			var view = new View (new Rect (0, 0, 10, 1)) {
+				Text = "Test 你"
+			};
+			Application.Top.Add (view);
+			Application.Begin (Application.Top);
+
+			Assert.True (view.IsAdded);
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 10, 1), view.Frame);
+			Assert.Equal ("Test 你", view.TextFormatter.Text);
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+Test 你
+", output);
+
+			view.Text = "First line 你\nSecond line 你";
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 10, 1), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+First line
+", output);
+
+			view.AutoSize = true;
+			Assert.True (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 14, 2), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+First line 你 
+Second line 你
+", output);
+
+			view.AutoSize = false;
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 10, 1), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+First line
+", output);
+		}
+
+		[Fact]
+		public void AutoSize_Layout_Absolute_Without_Add_Vertical_Wide ()
+		{
+			var view = new View (new Rect (0, 0, 1, 10)) {
+				Text = "Test 你",
+				TextDirection = TextDirection.TopBottom_LeftRight
+			};
+
+			Assert.False (view.IsAdded);
+			Assert.False (view.AutoSize);
+			// SetMinWidthHeight ensuring the minimum width for the wide char
+			Assert.Equal (new Rect (0, 0, 2, 10), view.Frame);
+			Assert.Equal ("Test 你", view.TextFormatter.Text);
+
+			view.Text = "First line 你\nSecond line 你";
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 2, 10), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+
+			view.AutoSize = true;
+			Assert.True (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 4, 13), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+
+			view.AutoSize = false;
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 4, 13), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+		}
+
+		[Fact, AutoInitShutdown]
+		public void AutoSize_Layout_Absolute_With_Add_Vertical_Wide ()
+		{
+			var view = new View (new Rect (0, 0, 1, 10)) {
+				Text = "Test 你",
+				TextDirection = TextDirection.TopBottom_LeftRight
+			};
+			Application.Top.Add (view);
+			Application.Begin (Application.Top);
+
+			Assert.True (view.IsAdded);
+			Assert.False (view.AutoSize);
+			// SetMinWidthHeight ensuring the minimum width for the wide char
+			Assert.Equal (new Rect (0, 0, 2, 10), view.Frame);
+			Assert.Equal ("Test 你", view.TextFormatter.Text);
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+T 
+e 
+s 
+t 
+  
+你
+", output);
+
+			view.Text = "First line 你\nSecond line 你";
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 2, 10), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+F
+i
+r
+s
+t
+ 
+l
+i
+n
+e
+", output);
+
+			view.AutoSize = true;
+			Assert.True (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 4, 13), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+F S 
+i e 
+r c 
+s o 
+t n 
+  d 
+l   
+i l 
+n i 
+e n 
+  e 
+你  
+  你
+", output);
+
+			view.AutoSize = false;
+			Assert.False (view.AutoSize);
+			Assert.Equal (new Rect (0, 0, 2, 10), view.Frame);
+			Assert.Equal ("First line 你\nSecond line 你", view.TextFormatter.Text);
+			Application.Refresh ();
+			GraphViewTests.AssertDriverContentsWithFrameAre (@"
+F
+i
+r
+s
+t
+ 
+l
+i
+n
+e
+", output);
+		}
+
 	}
 }