TextTests.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. using System;
  2. using System.Collections.Generic;
  3. using Xunit;
  4. using Xunit.Abstractions;
  5. namespace Terminal.Gui.ViewTests;
  6. /// <summary>
  7. /// Tests of the <see cref="View.Text"/> property with <see cref="View.AutoSize"/> set to false.
  8. /// </summary>
  9. public class TextTests {
  10. readonly ITestOutputHelper _output;
  11. public TextTests (ITestOutputHelper output) => _output = output;
  12. [Fact]
  13. [AutoInitShutdown]
  14. public void AutoSize_False_View_IsEmpty_False_Return_Null_Lines ()
  15. {
  16. var text = "Views";
  17. var view = new View {
  18. Width = Dim.Fill () - text.Length,
  19. Height = 1,
  20. Text = text
  21. };
  22. var win = new Window {
  23. Width = Dim.Fill (),
  24. Height = Dim.Fill ()
  25. };
  26. win.Add (view);
  27. Application.Top.Add (win);
  28. Application.Begin (Application.Top);
  29. ((FakeDriver)Application.Driver).SetBufferSize (10, 4);
  30. Assert.Equal (5, text.Length);
  31. Assert.False (view.AutoSize);
  32. Assert.Equal (new Rect (0, 0, 3, 1), view.Frame);
  33. Assert.Equal (new Size (3, 1), view.TextFormatter.Size);
  34. Assert.Equal (new List<string> { "Vie" }, view.TextFormatter.Lines);
  35. Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
  36. Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
  37. var expected = @"
  38. ┌────────┐
  39. │Vie │
  40. │ │
  41. └────────┘
  42. ";
  43. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  44. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  45. text = "0123456789";
  46. Assert.Equal (10, text.Length);
  47. view.Width = Dim.Fill () - text.Length;
  48. Application.Refresh ();
  49. Assert.Equal (new Rect (0, 0, 0, 1), view.Frame);
  50. Assert.Equal (new Size (0, 1), view.TextFormatter.Size);
  51. Assert.Equal (new List<string> { string.Empty }, view.TextFormatter.Lines);
  52. expected = @"
  53. ┌────────┐
  54. │ │
  55. │ │
  56. └────────┘
  57. ";
  58. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  59. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  60. }
  61. [Fact]
  62. [AutoInitShutdown]
  63. public void AutoSize_False_View_IsEmpty_True_Minimum_Height ()
  64. {
  65. var text = "Views";
  66. var view = new View {
  67. Width = Dim.Fill () - text.Length,
  68. Text = text
  69. };
  70. var win = new Window {
  71. Width = Dim.Fill (),
  72. Height = Dim.Fill ()
  73. };
  74. win.Add (view);
  75. Application.Top.Add (win);
  76. Application.Begin (Application.Top);
  77. ((FakeDriver)Application.Driver).SetBufferSize (10, 4);
  78. Assert.Equal (5, text.Length);
  79. Assert.False (view.AutoSize);
  80. Assert.Equal (new Rect (0, 0, 3, 1), view.Frame);
  81. Assert.Equal (new Size (3, 1), view.TextFormatter.Size);
  82. Assert.Single (view.TextFormatter.Lines);
  83. Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
  84. Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
  85. var expected = @"
  86. ┌────────┐
  87. │Vie │
  88. │ │
  89. └────────┘
  90. ";
  91. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  92. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  93. text = "0123456789";
  94. Assert.Equal (10, text.Length);
  95. view.Width = Dim.Fill () - text.Length;
  96. Application.Refresh ();
  97. Assert.Equal (new Rect (0, 0, 0, 1), view.Frame);
  98. Assert.Equal (new Size (0, 1), view.TextFormatter.Size);
  99. var exception = Record.Exception (() => Assert.Equal (new List<string> { string.Empty }, view.TextFormatter.Lines));
  100. Assert.Null (exception);
  101. expected = @"
  102. ┌────────┐
  103. │ │
  104. │ │
  105. └────────┘
  106. ";
  107. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  108. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  109. }
  110. [Fact]
  111. [AutoInitShutdown]
  112. public void AutoSize_False_Label_IsEmpty_True_Return_Null_Lines ()
  113. {
  114. var text = "Label";
  115. var label = new Label {
  116. Width = Dim.Fill () - text.Length,
  117. Height = 1,
  118. Text = text,
  119. AutoSize = false
  120. };
  121. var win = new Window {
  122. Width = Dim.Fill (),
  123. Height = Dim.Fill ()
  124. };
  125. win.Add (label);
  126. Application.Top.Add (win);
  127. Application.Begin (Application.Top);
  128. ((FakeDriver)Application.Driver).SetBufferSize (10, 4);
  129. Assert.Equal (5, text.Length);
  130. Assert.False (label.AutoSize);
  131. Assert.Equal (new Rect (0, 0, 3, 1), label.Frame);
  132. Assert.Equal (new Size (3, 1), label.TextFormatter.Size);
  133. Assert.Equal (new List<string> { "Lab" }, label.TextFormatter.Lines);
  134. Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
  135. Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
  136. var expected = @"
  137. ┌────────┐
  138. │Lab │
  139. │ │
  140. └────────┘
  141. ";
  142. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  143. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  144. text = "0123456789";
  145. Assert.Equal (10, text.Length);
  146. label.Width = Dim.Fill () - text.Length;
  147. Application.Refresh ();
  148. Assert.False (label.AutoSize);
  149. Assert.Equal (new Rect (0, 0, 0, 1), label.Frame);
  150. Assert.Equal (new Size (0, 1), label.TextFormatter.Size);
  151. Assert.Equal (new List<string> { string.Empty }, label.TextFormatter.Lines);
  152. expected = @"
  153. ┌────────┐
  154. │ │
  155. │ │
  156. └────────┘
  157. ";
  158. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  159. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  160. }
  161. [Fact]
  162. [AutoInitShutdown]
  163. public void AutoSize_False_Label_Height_Zero_Returns_Minimum_Height ()
  164. {
  165. var text = "Label";
  166. var label = new Label {
  167. Width = Dim.Fill () - text.Length,
  168. Text = text,
  169. AutoSize = false
  170. };
  171. var win = new Window {
  172. Width = Dim.Fill (),
  173. Height = Dim.Fill ()
  174. };
  175. win.Add (label);
  176. Application.Top.Add (win);
  177. Application.Begin (Application.Top);
  178. ((FakeDriver)Application.Driver).SetBufferSize (10, 4);
  179. Assert.Equal (5, text.Length);
  180. Assert.False (label.AutoSize);
  181. Assert.Equal (new Rect (0, 0, 3, 1), label.Frame);
  182. Assert.Equal (new Size (3, 1), label.TextFormatter.Size);
  183. Assert.Single (label.TextFormatter.Lines);
  184. Assert.Equal (new Rect (0, 0, 10, 4), win.Frame);
  185. Assert.Equal (new Rect (0, 0, 10, 4), Application.Top.Frame);
  186. var expected = @"
  187. ┌────────┐
  188. │Lab │
  189. │ │
  190. └────────┘
  191. ";
  192. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  193. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  194. text = "0123456789";
  195. Assert.Equal (10, text.Length);
  196. label.Width = Dim.Fill () - text.Length;
  197. Application.Refresh ();
  198. Assert.Equal (new Rect (0, 0, 0, 1), label.Frame);
  199. Assert.Equal (new Size (0, 1), label.TextFormatter.Size);
  200. var exception = Record.Exception (() => Assert.Equal (new List<string> { string.Empty }, label.TextFormatter.Lines));
  201. Assert.Null (exception);
  202. expected = @"
  203. ┌────────┐
  204. │ │
  205. │ │
  206. └────────┘
  207. ";
  208. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  209. Assert.Equal (new Rect (0, 0, 10, 4), pos);
  210. }
  211. [Fact]
  212. [AutoInitShutdown]
  213. public void AutoSize_False_View_Width_Null_Returns_Host_Frame_Width ()
  214. {
  215. var text = "Views";
  216. var view = new View {
  217. TextDirection = TextDirection.TopBottom_LeftRight,
  218. Height = Dim.Fill () - text.Length,
  219. Text = text
  220. };
  221. var win = new Window {
  222. Width = Dim.Fill (),
  223. Height = Dim.Fill ()
  224. };
  225. win.Add (view);
  226. Application.Top.Add (win);
  227. Application.Begin (Application.Top);
  228. ((FakeDriver)Application.Driver).SetBufferSize (4, 10);
  229. Assert.Equal (5, text.Length);
  230. Assert.False (view.AutoSize);
  231. Assert.Equal (new Rect (0, 0, 1, 3), view.Frame);
  232. Assert.Equal (new Size (1, 3), view.TextFormatter.Size);
  233. Assert.Single (view.TextFormatter.Lines);
  234. Assert.Equal (new Rect (0, 0, 4, 10), win.Frame);
  235. Assert.Equal (new Rect (0, 0, 4, 10), Application.Top.Frame);
  236. var expected = @"
  237. ┌──┐
  238. │V │
  239. │i │
  240. │e │
  241. │ │
  242. │ │
  243. │ │
  244. │ │
  245. │ │
  246. └──┘
  247. ";
  248. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  249. Assert.Equal (new Rect (0, 0, 4, 10), pos);
  250. text = "0123456789";
  251. Assert.Equal (10, text.Length);
  252. view.Height = Dim.Fill () - text.Length;
  253. Application.Refresh ();
  254. Assert.Equal (new Rect (0, 0, 1, 0), view.Frame);
  255. Assert.Equal (new Size (1, 0), view.TextFormatter.Size);
  256. var exception = Record.Exception (() => Assert.Equal (new List<string> { string.Empty }, view.TextFormatter.Lines));
  257. Assert.Null (exception);
  258. expected = @"
  259. ┌──┐
  260. │ │
  261. │ │
  262. │ │
  263. │ │
  264. │ │
  265. │ │
  266. │ │
  267. │ │
  268. └──┘
  269. ";
  270. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  271. Assert.Equal (new Rect (0, 0, 4, 10), pos);
  272. }
  273. [Fact]
  274. [AutoInitShutdown]
  275. public void AutoSize_False_View_Width_Zero_Returns_Minimum_Width_With_Wide_Rune ()
  276. {
  277. var text = "界View";
  278. var view = new View {
  279. TextDirection = TextDirection.TopBottom_LeftRight,
  280. Height = Dim.Fill () - text.Length,
  281. Text = text
  282. };
  283. var win = new Window {
  284. Width = Dim.Fill (),
  285. Height = Dim.Fill ()
  286. };
  287. win.Add (view);
  288. Application.Top.Add (win);
  289. Application.Begin (Application.Top);
  290. ((FakeDriver)Application.Driver).SetBufferSize (4, 10);
  291. Assert.Equal (5, text.Length);
  292. Assert.False (view.AutoSize);
  293. Assert.Equal (new Rect (0, 0, 2, 3), view.Frame);
  294. Assert.Equal (new Size (2, 3), view.TextFormatter.Size);
  295. Assert.Single (view.TextFormatter.Lines);
  296. Assert.Equal (new Rect (0, 0, 4, 10), win.Frame);
  297. Assert.Equal (new Rect (0, 0, 4, 10), Application.Top.Frame);
  298. var expected = @"
  299. ┌──┐
  300. │界│
  301. │V │
  302. │i │
  303. │ │
  304. │ │
  305. │ │
  306. │ │
  307. │ │
  308. └──┘
  309. ";
  310. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  311. Assert.Equal (new Rect (0, 0, 4, 10), pos);
  312. text = "0123456789";
  313. Assert.Equal (10, text.Length);
  314. view.Height = Dim.Fill () - text.Length;
  315. Application.Refresh ();
  316. Assert.Equal (new Rect (0, 0, 2, 0), view.Frame);
  317. Assert.Equal (new Size (2, 0), view.TextFormatter.Size);
  318. var exception = Record.Exception (() => Assert.Equal (new List<string> { string.Empty }, view.TextFormatter.Lines));
  319. Assert.Null (exception);
  320. expected = @"
  321. ┌──┐
  322. │ │
  323. │ │
  324. │ │
  325. │ │
  326. │ │
  327. │ │
  328. │ │
  329. │ │
  330. └──┘
  331. ";
  332. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  333. Assert.Equal (new Rect (0, 0, 4, 10), pos);
  334. }
  335. [Fact]
  336. public void AutoSize_False_If_Text_Empty ()
  337. {
  338. var view1 = new View ();
  339. var view2 = new View ("");
  340. var view3 = new View { Text = "" };
  341. Assert.False (view1.AutoSize);
  342. Assert.False (view2.AutoSize);
  343. Assert.False (view3.AutoSize);
  344. view1.Dispose ();
  345. view2.Dispose ();
  346. view3.Dispose ();
  347. }
  348. [Fact]
  349. public void AutoSize_False_If_Text_Is_Not_Empty ()
  350. {
  351. var view1 = new View ();
  352. view1.Text = "Hello World";
  353. var view2 = new View ("Hello World");
  354. var view3 = new View { Text = "Hello World" };
  355. Assert.False (view1.AutoSize);
  356. Assert.False (view2.AutoSize);
  357. Assert.False (view3.AutoSize);
  358. view1.Dispose ();
  359. view2.Dispose ();
  360. view3.Dispose ();
  361. }
  362. [Fact]
  363. public void AutoSize_False_ResizeView_Is_Always_False ()
  364. {
  365. var super = new View ();
  366. var label = new Label { AutoSize = false };
  367. super.Add (label);
  368. label.Text = "New text";
  369. super.LayoutSubviews ();
  370. Assert.False (label.AutoSize);
  371. Assert.Equal ("(0,0,0,1)", label.Bounds.ToString ());
  372. super.Dispose ();
  373. }
  374. [Fact]
  375. [AutoInitShutdown]
  376. public void AutoSize_False_ResizeView_With_Dim_Fill_After_IsInitialized ()
  377. {
  378. var win = new Window (new Rect (0, 0, 30, 80));
  379. var label = new Label { AutoSize = false, Width = Dim.Fill (), Height = Dim.Fill () };
  380. win.Add (label);
  381. Application.Top.Add (win);
  382. Assert.False (label.AutoSize);
  383. Assert.Equal ("(0,0,80,25)", label.Bounds.ToString ());
  384. label.Text = "New text\nNew line";
  385. Application.Top.LayoutSubviews ();
  386. Assert.False (label.AutoSize);
  387. Assert.Equal ("(0,0,28,78)", label.Bounds.ToString ());
  388. Assert.False (label.IsInitialized);
  389. var rs = Application.Begin (Application.Top);
  390. Assert.True (label.IsInitialized);
  391. Assert.False (label.AutoSize);
  392. Assert.Equal ("(0,0,28,78)", label.Bounds.ToString ());
  393. Application.End (rs);
  394. }
  395. [Fact]
  396. [AutoInitShutdown]
  397. public void AutoSize_False_Equal_Before_And_After_IsInitialized_With_Differents_Orders ()
  398. {
  399. var view1 = new View { Text = "Say Hello view1 你", AutoSize = false, Width = 10, Height = 5 };
  400. var view2 = new View { Text = "Say Hello view2 你", Width = 10, Height = 5, AutoSize = false };
  401. var view3 = new View { AutoSize = false, Width = 10, Height = 5, Text = "Say Hello view3 你" };
  402. var view4 = new View {
  403. Text = "Say Hello view4 你",
  404. AutoSize = false,
  405. Width = 10,
  406. Height = 5,
  407. TextDirection = TextDirection.TopBottom_LeftRight
  408. };
  409. var view5 = new View {
  410. Text = "Say Hello view5 你",
  411. Width = 10,
  412. Height = 5,
  413. AutoSize = false,
  414. TextDirection = TextDirection.TopBottom_LeftRight
  415. };
  416. var view6 = new View {
  417. AutoSize = false,
  418. Width = 10,
  419. Height = 5,
  420. TextDirection = TextDirection.TopBottom_LeftRight,
  421. Text = "Say Hello view6 你"
  422. };
  423. Application.Top.Add (view1, view2, view3, view4, view5, view6);
  424. Assert.False (view1.IsInitialized);
  425. Assert.False (view2.IsInitialized);
  426. Assert.False (view3.IsInitialized);
  427. Assert.False (view4.IsInitialized);
  428. Assert.False (view5.IsInitialized);
  429. Assert.False (view1.AutoSize);
  430. Assert.Equal (new Rect (0, 0, 10, 5), view1.Frame);
  431. Assert.Equal ("Absolute(10)", view1.Width.ToString ());
  432. Assert.Equal ("Absolute(5)", view1.Height.ToString ());
  433. Assert.False (view2.AutoSize);
  434. Assert.Equal (new Rect (0, 0, 10, 5), view2.Frame);
  435. Assert.Equal ("Absolute(10)", view2.Width.ToString ());
  436. Assert.Equal ("Absolute(5)", view2.Height.ToString ());
  437. Assert.False (view3.AutoSize);
  438. Assert.Equal (new Rect (0, 0, 10, 5), view3.Frame);
  439. Assert.Equal ("Absolute(10)", view3.Width.ToString ());
  440. Assert.Equal ("Absolute(5)", view3.Height.ToString ());
  441. Assert.False (view4.AutoSize);
  442. Assert.Equal (new Rect (0, 0, 10, 5), view4.Frame);
  443. Assert.Equal ("Absolute(10)", view4.Width.ToString ());
  444. Assert.Equal ("Absolute(5)", view4.Height.ToString ());
  445. Assert.False (view5.AutoSize);
  446. Assert.Equal (new Rect (0, 0, 10, 5), view5.Frame);
  447. Assert.Equal ("Absolute(10)", view5.Width.ToString ());
  448. Assert.Equal ("Absolute(5)", view5.Height.ToString ());
  449. Assert.False (view6.AutoSize);
  450. Assert.Equal (new Rect (0, 0, 10, 5), view6.Frame);
  451. Assert.Equal ("Absolute(10)", view6.Width.ToString ());
  452. Assert.Equal ("Absolute(5)", view6.Height.ToString ());
  453. var rs = Application.Begin (Application.Top);
  454. Assert.True (view1.IsInitialized);
  455. Assert.True (view2.IsInitialized);
  456. Assert.True (view3.IsInitialized);
  457. Assert.True (view4.IsInitialized);
  458. Assert.True (view5.IsInitialized);
  459. Assert.False (view1.AutoSize);
  460. Assert.Equal (new Rect (0, 0, 10, 5), view1.Frame);
  461. Assert.Equal ("Absolute(10)", view1.Width.ToString ());
  462. Assert.Equal ("Absolute(5)", view1.Height.ToString ());
  463. Assert.False (view2.AutoSize);
  464. Assert.Equal (new Rect (0, 0, 10, 5), view2.Frame);
  465. Assert.Equal ("Absolute(10)", view2.Width.ToString ());
  466. Assert.Equal ("Absolute(5)", view2.Height.ToString ());
  467. Assert.False (view3.AutoSize);
  468. Assert.Equal (new Rect (0, 0, 10, 5), view3.Frame);
  469. Assert.Equal ("Absolute(10)", view3.Width.ToString ());
  470. Assert.Equal ("Absolute(5)", view3.Height.ToString ());
  471. Assert.False (view4.AutoSize);
  472. Assert.Equal (new Rect (0, 0, 10, 5), view4.Frame);
  473. Assert.Equal ("Absolute(10)", view4.Width.ToString ());
  474. Assert.Equal ("Absolute(5)", view4.Height.ToString ());
  475. Assert.False (view5.AutoSize);
  476. Assert.Equal (new Rect (0, 0, 10, 5), view5.Frame);
  477. Assert.Equal ("Absolute(10)", view5.Width.ToString ());
  478. Assert.Equal ("Absolute(5)", view5.Height.ToString ());
  479. Assert.False (view6.AutoSize);
  480. Assert.Equal (new Rect (0, 0, 10, 5), view6.Frame);
  481. Assert.Equal ("Absolute(10)", view6.Width.ToString ());
  482. Assert.Equal ("Absolute(5)", view6.Height.ToString ());
  483. Application.End (rs);
  484. }
  485. [Fact]
  486. [AutoInitShutdown]
  487. public void AutoSize_False_Width_Height_SetMinWidthHeight_Narrow_Wide_Runes ()
  488. {
  489. string text = $"First line{Environment.NewLine}Second line";
  490. var horizontalView = new View () {
  491. Width = 20,
  492. Height = 1,
  493. Text = text
  494. };
  495. var verticalView = new View () {
  496. Y = 3,
  497. Height = 20,
  498. Width = 1,
  499. Text = text,
  500. TextDirection = TextDirection.TopBottom_LeftRight
  501. };
  502. var win = new Window () {
  503. Width = Dim.Fill (),
  504. Height = Dim.Fill (),
  505. Text = "Window"
  506. };
  507. win.Add (horizontalView, verticalView);
  508. Application.Top.Add (win);
  509. var rs = Application.Begin (Application.Top);
  510. ((FakeDriver)Application.Driver).SetBufferSize (32, 32);
  511. Assert.False (horizontalView.AutoSize);
  512. Assert.False (verticalView.AutoSize);
  513. Assert.Equal (new Rect (0, 0, 20, 1), horizontalView.Frame);
  514. Assert.Equal (new Rect (0, 3, 1, 20), verticalView.Frame);
  515. string expected = @"
  516. ┌──────────────────────────────┐
  517. │First line Second li │
  518. │ │
  519. │ │
  520. │F │
  521. │i │
  522. │r │
  523. │s │
  524. │t │
  525. │ │
  526. │l │
  527. │i │
  528. │n │
  529. │e │
  530. │ │
  531. │S │
  532. │e │
  533. │c │
  534. │o │
  535. │n │
  536. │d │
  537. │ │
  538. │l │
  539. │i │
  540. │ │
  541. │ │
  542. │ │
  543. │ │
  544. │ │
  545. │ │
  546. │ │
  547. └──────────────────────────────┘
  548. ";
  549. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  550. verticalView.Text = $"最初の行{Environment.NewLine}二行目";
  551. Application.Top.Draw ();
  552. // BUGBUG: #3127 - If AutoSize == false, setting text should NOT change the size of the view.
  553. Assert.Equal (new Rect (0, 3, 2, 20), verticalView.Frame);
  554. expected = @"
  555. ┌──────────────────────────────┐
  556. │First line Second li │
  557. │ │
  558. │ │
  559. │最 │
  560. │初 │
  561. │の │
  562. │行 │
  563. │ │
  564. │二 │
  565. │行 │
  566. │目 │
  567. │ │
  568. │ │
  569. │ │
  570. │ │
  571. │ │
  572. │ │
  573. │ │
  574. │ │
  575. │ │
  576. │ │
  577. │ │
  578. │ │
  579. │ │
  580. │ │
  581. │ │
  582. │ │
  583. │ │
  584. │ │
  585. │ │
  586. └──────────────────────────────┘
  587. ";
  588. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  589. Application.End (rs);
  590. }
  591. }