WizardTests.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. using Xunit.Abstractions;
  2. namespace Terminal.Gui.DialogTests;
  3. public class WizardTests ()
  4. {
  5. // =========== Wizard Tests
  6. [Fact]
  7. public void DefaultConstructor_SizedProperly ()
  8. {
  9. var wizard = new Wizard ();
  10. Assert.NotEqual (0, wizard.Width);
  11. Assert.NotEqual (0, wizard.Height);
  12. wizard.Dispose ();
  13. }
  14. [Fact]
  15. [AutoInitShutdown]
  16. public void Finish_Button_Closes ()
  17. {
  18. // https://github.com/gui-cs/Terminal.Gui/issues/1833
  19. var wizard = new Wizard ();
  20. var step1 = new WizardStep { Title = "step1" };
  21. wizard.AddStep (step1);
  22. var finishedFired = false;
  23. wizard.Finished += (s, args) => { finishedFired = true; };
  24. var closedFired = false;
  25. wizard.Closed += (s, e) => { closedFired = true; };
  26. RunState runstate = Application.Begin (wizard);
  27. var firstIteration = true;
  28. Application.RunIteration (ref runstate, ref firstIteration);
  29. wizard.NextFinishButton.InvokeCommand (Command.Accept);
  30. Application.RunIteration (ref runstate, ref firstIteration);
  31. Application.End (runstate);
  32. Assert.True (finishedFired);
  33. Assert.True (closedFired);
  34. step1.Dispose ();
  35. wizard.Dispose ();
  36. // Same test, but with two steps
  37. wizard = new ();
  38. firstIteration = false;
  39. step1 = new() { Title = "step1" };
  40. wizard.AddStep (step1);
  41. var step2 = new WizardStep { Title = "step2" };
  42. wizard.AddStep (step2);
  43. finishedFired = false;
  44. wizard.Finished += (s, args) => { finishedFired = true; };
  45. closedFired = false;
  46. wizard.Closed += (s, e) => { closedFired = true; };
  47. runstate = Application.Begin (wizard);
  48. Application.RunIteration (ref runstate, ref firstIteration);
  49. Assert.Equal (step1.Title, wizard.CurrentStep.Title);
  50. wizard.NextFinishButton.InvokeCommand (Command.Accept);
  51. Assert.False (finishedFired);
  52. Assert.False (closedFired);
  53. Assert.Equal (step2.Title, wizard.CurrentStep.Title);
  54. Assert.Equal (wizard.GetLastStep ().Title, wizard.CurrentStep.Title);
  55. wizard.NextFinishButton.InvokeCommand (Command.Accept);
  56. Application.End (runstate);
  57. Assert.True (finishedFired);
  58. Assert.True (closedFired);
  59. step1.Dispose ();
  60. step2.Dispose ();
  61. wizard.Dispose ();
  62. // Same test, but with two steps but the 1st one disabled
  63. wizard = new ();
  64. firstIteration = false;
  65. step1 = new() { Title = "step1" };
  66. wizard.AddStep (step1);
  67. step2 = new() { Title = "step2" };
  68. wizard.AddStep (step2);
  69. step1.Enabled = false;
  70. finishedFired = false;
  71. wizard.Finished += (s, args) => { finishedFired = true; };
  72. closedFired = false;
  73. wizard.Closed += (s, e) => { closedFired = true; };
  74. runstate = Application.Begin (wizard);
  75. Application.RunIteration (ref runstate, ref firstIteration);
  76. Assert.Equal (step2.Title, wizard.CurrentStep.Title);
  77. Assert.Equal (wizard.GetLastStep ().Title, wizard.CurrentStep.Title);
  78. wizard.NextFinishButton.InvokeCommand (Command.Accept);
  79. Application.End (runstate);
  80. Assert.True (finishedFired);
  81. Assert.True (closedFired);
  82. wizard.Dispose ();
  83. }
  84. [Fact]
  85. public void Navigate_GetFirstStep_Works ()
  86. {
  87. var wizard = new Wizard ();
  88. Assert.Null (wizard.GetFirstStep ());
  89. var step1 = new WizardStep { Title = "step1" };
  90. wizard.AddStep (step1);
  91. Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
  92. var step2 = new WizardStep { Title = "step2" };
  93. wizard.AddStep (step2);
  94. Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
  95. var step3 = new WizardStep { Title = "step3" };
  96. wizard.AddStep (step3);
  97. Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
  98. step1.Enabled = false;
  99. Assert.Equal (step2.Title, wizard.GetFirstStep ().Title);
  100. step1.Enabled = true;
  101. Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
  102. step1.Enabled = false;
  103. step2.Enabled = false;
  104. Assert.Equal (step3.Title, wizard.GetFirstStep ().Title);
  105. wizard.Dispose ();
  106. }
  107. [Fact]
  108. public void Navigate_GetLastStep_Works ()
  109. {
  110. var wizard = new Wizard ();
  111. Assert.Null (wizard.GetLastStep ());
  112. var step1 = new WizardStep { Title = "step1" };
  113. wizard.AddStep (step1);
  114. Assert.Equal (step1.Title, wizard.GetLastStep ().Title);
  115. var step2 = new WizardStep { Title = "step2" };
  116. wizard.AddStep (step2);
  117. Assert.Equal (step2.Title, wizard.GetLastStep ().Title);
  118. var step3 = new WizardStep { Title = "step3" };
  119. wizard.AddStep (step3);
  120. Assert.Equal (step3.Title, wizard.GetLastStep ().Title);
  121. step3.Enabled = false;
  122. Assert.Equal (step2.Title, wizard.GetLastStep ().Title);
  123. step3.Enabled = true;
  124. Assert.Equal (step3.Title, wizard.GetLastStep ().Title);
  125. step3.Enabled = false;
  126. step2.Enabled = false;
  127. Assert.Equal (step1.Title, wizard.GetLastStep ().Title);
  128. wizard.Dispose ();
  129. }
  130. [Fact]
  131. [AutoInitShutdown]
  132. public void Navigate_GetNextStep_Correct ()
  133. {
  134. var wizard = new Wizard ();
  135. // If no steps should be null
  136. Assert.Null (wizard.GetNextStep ());
  137. var step1 = new WizardStep { Title = "step1" };
  138. wizard.AddStep (step1);
  139. // If no current step, should be first step
  140. Assert.Equal (step1.Title, wizard.GetNextStep ().Title);
  141. wizard.CurrentStep = step1;
  142. // If there is 1 step it's current step should be null
  143. Assert.Null (wizard.GetNextStep ());
  144. // If one disabled step should be null
  145. step1.Enabled = false;
  146. Assert.Null (wizard.GetNextStep ());
  147. // If two steps and at 1 and step 2 is `Enabled = true`should be step 2
  148. var step2 = new WizardStep { Title = "step2" };
  149. wizard.AddStep (step2);
  150. Assert.Equal (step2.Title, wizard.GetNextStep ().Title);
  151. // If two steps and at 1 and step 2 is `Enabled = false` should be null
  152. step1.Enabled = true;
  153. wizard.CurrentStep = step1;
  154. step2.Enabled = false;
  155. Assert.Null (wizard.GetNextStep ());
  156. // If three steps with Step2.Enabled = true
  157. // At step 1 should be step 2
  158. // At step 2 should be step 3
  159. // At step 3 should be null
  160. var step3 = new WizardStep { Title = "step3" };
  161. wizard.AddStep (step3);
  162. step1.Enabled = true;
  163. wizard.CurrentStep = step1;
  164. step2.Enabled = true;
  165. step3.Enabled = true;
  166. Assert.Equal (step2.Title, wizard.GetNextStep ().Title);
  167. wizard.CurrentStep = step2;
  168. Assert.Equal (step3.Title, wizard.GetNextStep ().Title);
  169. wizard.CurrentStep = step3;
  170. Assert.Null (wizard.GetNextStep ());
  171. // If three steps with Step2.Enabled = false
  172. // At step 1 should be step 3
  173. // At step 3 should be null
  174. step1.Enabled = true;
  175. wizard.CurrentStep = step1;
  176. step2.Enabled = false;
  177. step3.Enabled = true;
  178. Assert.Equal (step3.Title, wizard.GetNextStep ().Title);
  179. wizard.CurrentStep = step3;
  180. Assert.Null (wizard.GetNextStep ());
  181. // If three steps with Step2.Enabled = false & Step3.Enabled = false
  182. // At step 1 should be null
  183. step1.Enabled = true;
  184. wizard.CurrentStep = step1;
  185. step2.Enabled = false;
  186. step3.Enabled = false;
  187. Assert.Null (wizard.GetNextStep ());
  188. // If no current step, GetNextStep provides equivalent to GetFirstStep
  189. wizard.CurrentStep = null;
  190. step1.Enabled = true;
  191. step2.Enabled = true;
  192. step3.Enabled = true;
  193. Assert.Equal (step1.Title, wizard.GetNextStep ().Title);
  194. step1.Enabled = false;
  195. step2.Enabled = true;
  196. step3.Enabled = true;
  197. Assert.Equal (step2.Title, wizard.GetNextStep ().Title);
  198. step1.Enabled = false;
  199. step2.Enabled = false;
  200. step3.Enabled = true;
  201. Assert.Equal (step3.Title, wizard.GetNextStep ().Title);
  202. step1.Enabled = false;
  203. step2.Enabled = true;
  204. step3.Enabled = false;
  205. Assert.Equal (step2.Title, wizard.GetNextStep ().Title);
  206. step1.Enabled = true;
  207. step2.Enabled = false;
  208. step3.Enabled = false;
  209. Assert.Equal (step1.Title, wizard.GetNextStep ().Title);
  210. wizard.Dispose ();
  211. }
  212. [Fact]
  213. [AutoInitShutdown]
  214. public void Navigate_GetPreviousStep_Correct ()
  215. {
  216. var wizard = new Wizard ();
  217. // If no steps should be null
  218. Assert.Null (wizard.GetPreviousStep ());
  219. var step1 = new WizardStep { Title = "step1" };
  220. wizard.AddStep (step1);
  221. // If no current step, should be last step
  222. Assert.Equal (step1.Title, wizard.GetPreviousStep ().Title);
  223. wizard.CurrentStep = step1;
  224. // If there is 1 step it's current step should be null
  225. Assert.Null (wizard.GetPreviousStep ());
  226. // If one disabled step should be null
  227. step1.Enabled = false;
  228. Assert.Null (wizard.GetPreviousStep ());
  229. // If two steps and at 2 and step 1 is `Enabled = true`should be step1
  230. var step2 = new WizardStep { Title = "step2" };
  231. wizard.AddStep (step2);
  232. wizard.CurrentStep = step2;
  233. step1.Enabled = true;
  234. Assert.Equal (step1.Title, wizard.GetPreviousStep ().Title);
  235. // If two steps and at 2 and step 1 is `Enabled = false` should be null
  236. step1.Enabled = false;
  237. Assert.Null (wizard.GetPreviousStep ());
  238. // If three steps with Step2.Enabled = true
  239. // At step 1 should be null
  240. // At step 2 should be step 1
  241. // At step 3 should be step 2
  242. var step3 = new WizardStep { Title = "step3" };
  243. wizard.AddStep (step3);
  244. step1.Enabled = true;
  245. wizard.CurrentStep = step1;
  246. step2.Enabled = true;
  247. step3.Enabled = true;
  248. Assert.Null (wizard.GetPreviousStep ());
  249. wizard.CurrentStep = step2;
  250. Assert.Equal (step1.Title, wizard.GetPreviousStep ().Title);
  251. wizard.CurrentStep = step3;
  252. Assert.Equal (step2.Title, wizard.GetPreviousStep ().Title);
  253. // If three steps with Step2.Enabled = false
  254. // At step 1 should be null
  255. // At step 3 should be step1
  256. step1.Enabled = true;
  257. step2.Enabled = false;
  258. step3.Enabled = true;
  259. wizard.CurrentStep = step1;
  260. Assert.Null (wizard.GetPreviousStep ());
  261. wizard.CurrentStep = step3;
  262. Assert.Equal (step1.Title, wizard.GetPreviousStep ().Title);
  263. // If three steps with Step1.Enabled = false & Step2.Enabled = false
  264. // At step 3 should be null
  265. // If no current step, GetPreviousStep provides equivalent to GetLastStep
  266. wizard.CurrentStep = null;
  267. step1.Enabled = true;
  268. step2.Enabled = true;
  269. step3.Enabled = true;
  270. Assert.Equal (step3.Title, wizard.GetPreviousStep ().Title);
  271. step1.Enabled = false;
  272. step2.Enabled = true;
  273. step3.Enabled = true;
  274. Assert.Equal (step3.Title, wizard.GetPreviousStep ().Title);
  275. step1.Enabled = false;
  276. step2.Enabled = false;
  277. step3.Enabled = true;
  278. Assert.Equal (step3.Title, wizard.GetPreviousStep ().Title);
  279. step1.Enabled = false;
  280. step2.Enabled = true;
  281. step3.Enabled = false;
  282. Assert.Equal (step2.Title, wizard.GetPreviousStep ().Title);
  283. step1.Enabled = true;
  284. step2.Enabled = false;
  285. step3.Enabled = false;
  286. Assert.Equal (step1.Title, wizard.GetPreviousStep ().Title);
  287. wizard.Dispose ();
  288. }
  289. [Fact]
  290. public void Navigate_GoBack_Works ()
  291. {
  292. // If zero steps do nothing
  293. // If one step do nothing (enabled or disabled)
  294. // If two steps
  295. // If current is 1 does nothing
  296. // If current is 2 does nothing
  297. // If 1 is enabled 2 becomes current
  298. // If 1 is disabled 1 stays current
  299. }
  300. [Fact]
  301. public void Navigate_GoNext_Works ()
  302. {
  303. // If zero steps do nothing
  304. // If one step do nothing (enabled or disabled)
  305. // If two steps
  306. // If current is 1
  307. // If 2 is enabled 2 becomes current
  308. // If 2 is disabled 1 stays current
  309. // If current is 2 does nothing
  310. }
  311. [Fact]
  312. [AutoInitShutdown]
  313. // This test verifies that a single step wizard shows the correct buttons
  314. // and that the title is correct
  315. public void OneStepWizard_Shows ()
  316. {
  317. var d = (FakeDriver)Application.Driver;
  318. var title = "1234";
  319. var stepTitle = "ABCD";
  320. var width = 30;
  321. var height = 7;
  322. d.SetBufferSize (width, height);
  323. // var btnBackText = "Back";
  324. var btnBack = string.Empty; // $"{CM.Glyphs.LeftBracket} {btnBackText} {CM.Glyphs.RightBracket}";
  325. var btnNextText = "Finish"; // "Next";
  326. var btnNext =
  327. $"{
  328. CM.Glyphs.LeftBracket
  329. }{
  330. CM.Glyphs.LeftDefaultIndicator
  331. } {
  332. btnNextText
  333. } {
  334. CM.Glyphs.RightDefaultIndicator
  335. }{
  336. CM.Glyphs.RightBracket
  337. }";
  338. var topRow =
  339. $"{
  340. CM.Glyphs.ULCornerDbl
  341. }╡{
  342. title
  343. } - {
  344. stepTitle
  345. }╞{
  346. new (CM.Glyphs.HLineDbl.ToString () [0], width - title.Length - stepTitle.Length - 7)
  347. }{
  348. CM.Glyphs.URCornerDbl
  349. }";
  350. var row2 = $"{CM.Glyphs.VLineDbl}{new (' ', width - 2)}{CM.Glyphs.VLineDbl}";
  351. string row3 = row2;
  352. string row4 = row3;
  353. var separatorRow =
  354. $"{CM.Glyphs.VLineDbl}{new (CM.Glyphs.HLine.ToString () [0], width - 2)}{CM.Glyphs.VLineDbl}";
  355. var buttonRow =
  356. $"{
  357. CM.Glyphs.VLineDbl
  358. }{
  359. btnBack
  360. }{
  361. new (' ', width - btnBack.Length - btnNext.Length - 2)
  362. }{
  363. btnNext
  364. }{
  365. CM.Glyphs.VLineDbl
  366. }";
  367. var bottomRow =
  368. $"{
  369. CM.Glyphs.LLCornerDbl
  370. }{
  371. new (CM.Glyphs.HLineDbl.ToString () [0], width - 2)
  372. }{
  373. CM.Glyphs.LRCornerDbl
  374. }";
  375. var wizard = new Wizard { Title = title, Width = width, Height = height };
  376. wizard.AddStep (new() { Title = stepTitle });
  377. //wizard.LayoutSubviews ();
  378. var firstIteration = false;
  379. RunState runstate = Application.Begin (wizard);
  380. Application.RunIteration (ref runstate, ref firstIteration);
  381. // TODO: Disabled until Dim.Auto is used in Dialog
  382. //TestHelpers.AssertDriverContentsWithFrameAre (
  383. // $"{topRow}\n{row2}\n{row3}\n{row4}\n{separatorRow}\n{buttonRow}\n{bottomRow}",
  384. // _output
  385. // );
  386. Application.End (runstate);
  387. wizard.Dispose ();
  388. }
  389. [Fact]
  390. [AutoInitShutdown]
  391. // this test is needed because Wizard overrides Dialog's title behavior ("Title - StepTitle")
  392. public void Setting_Title_Works ()
  393. {
  394. var d = (FakeDriver)Application.Driver;
  395. var title = "1234";
  396. var stepTitle = " - ABCD";
  397. var width = 40;
  398. var height = 4;
  399. d.SetBufferSize (width, height);
  400. var btnNextText = "Finish";
  401. var btnNext =
  402. $"{
  403. CM.Glyphs.LeftBracket
  404. }{
  405. CM.Glyphs.LeftDefaultIndicator
  406. } {
  407. btnNextText
  408. } {
  409. CM.Glyphs.RightDefaultIndicator
  410. }{
  411. CM.Glyphs.RightBracket
  412. }";
  413. var topRow =
  414. $"{
  415. CM.Glyphs.ULCornerDbl
  416. }╡{
  417. title
  418. }{
  419. stepTitle
  420. }╞{
  421. new (CM.Glyphs.HLineDbl.ToString () [0], width - title.Length - stepTitle.Length - 4)
  422. }{
  423. CM.Glyphs.URCornerDbl
  424. }";
  425. var separatorRow =
  426. $"{CM.Glyphs.VLineDbl}{new (CM.Glyphs.HLine.ToString () [0], width - 2)}{CM.Glyphs.VLineDbl}";
  427. // Once this is fixed, revert to commented out line: https://github.com/gui-cs/Terminal.Gui/issues/1791
  428. var buttonRow =
  429. $"{CM.Glyphs.VLineDbl}{new (' ', width - btnNext.Length - 2)}{btnNext}{CM.Glyphs.VLineDbl}";
  430. //var buttonRow = $"{CM.Glyphs.VDLine}{new String (' ', width - btnNext.Length - 2)}{btnNext}{CM.Glyphs.VDLine}";
  431. var bottomRow =
  432. $"{
  433. CM.Glyphs.LLCornerDbl
  434. }{
  435. new (CM.Glyphs.HLineDbl.ToString () [0], width - 2)
  436. }{
  437. CM.Glyphs.LRCornerDbl
  438. }";
  439. var wizard = new Wizard { Title = title, Width = width, Height = height };
  440. wizard.AddStep (new() { Title = "ABCD" });
  441. Application.End (Application.Begin (wizard));
  442. wizard.Dispose ();
  443. }
  444. [Fact]
  445. // This test verifies that the 2nd step in a wizard with more than 2 steps
  446. // shows the correct buttons on all steps
  447. // and that the title is correct
  448. public void ThreeStepWizard_Next_Shows_Steps ()
  449. {
  450. // verify step one
  451. // Next
  452. // verify step two
  453. // Back
  454. // verify step one again
  455. }
  456. [Fact]
  457. // This test verifies that the 2nd step in a wizard with 2 steps
  458. // shows the correct buttons on both steps
  459. // and that the title is correct
  460. public void TwoStepWizard_Next_Shows_SecondStep ()
  461. {
  462. // verify step one
  463. // Next
  464. // verify step two
  465. // Back
  466. // verify step one again
  467. }
  468. // =========== WizardStep Tests
  469. [Fact]
  470. public void WizardStep_ButtonText ()
  471. {
  472. // Verify default button text
  473. // Verify set actually changes property
  474. // Verify set actually changes buttons for the current step
  475. }
  476. [Fact]
  477. public void WizardStep_Set_Title_Fires_TitleChanged ()
  478. {
  479. var r = new Window ();
  480. Assert.Equal (string.Empty, r.Title);
  481. var expected = string.Empty;
  482. r.TitleChanged += (s, args) => { Assert.Equal (r.Title, args.CurrentValue); };
  483. expected = "title";
  484. r.Title = expected;
  485. Assert.Equal (expected, r.Title);
  486. expected = "another title";
  487. r.Title = expected;
  488. Assert.Equal (expected, r.Title);
  489. r.Dispose ();
  490. }
  491. [Fact]
  492. public void WizardStep_Set_Title_Fires_TitleChanging ()
  493. {
  494. var r = new Window ();
  495. Assert.Equal (string.Empty, r.Title);
  496. var expectedAfter = string.Empty;
  497. var expectedDuring = string.Empty;
  498. var cancel = false;
  499. r.TitleChanging += (s, args) =>
  500. {
  501. Assert.Equal (expectedDuring, args.NewValue);
  502. args.Cancel = cancel;
  503. };
  504. r.Title = expectedDuring = expectedAfter = "title";
  505. Assert.Equal (expectedAfter, r.Title);
  506. r.Title = expectedDuring = expectedAfter = "a different title";
  507. Assert.Equal (expectedAfter, r.Title);
  508. // Now setup cancelling the change and change it back to "title"
  509. cancel = true;
  510. r.Title = expectedDuring = "title";
  511. Assert.Equal (expectedAfter, r.Title);
  512. r.Dispose ();
  513. }
  514. [Fact]
  515. [AutoInitShutdown]
  516. // Verify a zero-step wizard doesn't crash and shows a blank wizard
  517. // and that the title is correct
  518. public void ZeroStepWizard_Shows ()
  519. {
  520. var d = (FakeDriver)Application.Driver;
  521. var title = "1234";
  522. var stepTitle = "";
  523. var width = 30;
  524. var height = 6;
  525. d.SetBufferSize (width, height);
  526. var btnBackText = "Back";
  527. var btnBack = $"{CM.Glyphs.LeftBracket} {btnBackText} {CM.Glyphs.RightBracket}";
  528. var btnNextText = "Finish";
  529. var btnNext =
  530. $"{
  531. CM.Glyphs.LeftBracket
  532. }{
  533. CM.Glyphs.LeftDefaultIndicator
  534. } {
  535. btnNextText
  536. } {
  537. CM.Glyphs.RightDefaultIndicator
  538. }{
  539. CM.Glyphs.RightBracket
  540. }";
  541. var topRow =
  542. $"{
  543. CM.Glyphs.ULCornerDbl
  544. }╡{
  545. title
  546. }{
  547. stepTitle
  548. }╞{
  549. new (CM.Glyphs.HLineDbl.ToString () [0], width - title.Length - stepTitle.Length - 4)
  550. }{
  551. CM.Glyphs.URCornerDbl
  552. }";
  553. var row2 = $"{CM.Glyphs.VLineDbl}{new (' ', width - 2)}{CM.Glyphs.VLineDbl}";
  554. string row3 = row2;
  555. var separatorRow =
  556. $"{CM.Glyphs.VLineDbl}{new (CM.Glyphs.HLine.ToString () [0], width - 2)}{CM.Glyphs.VLineDbl}";
  557. var buttonRow =
  558. $"{
  559. CM.Glyphs.VLineDbl
  560. }{
  561. btnBack
  562. }{
  563. new (' ', width - btnBack.Length - btnNext.Length - 2)
  564. }{
  565. btnNext
  566. }{
  567. CM.Glyphs.VLineDbl
  568. }";
  569. var bottomRow =
  570. $"{
  571. CM.Glyphs.LLCornerDbl
  572. }{
  573. new (CM.Glyphs.HLineDbl.ToString () [0], width - 2)
  574. }{
  575. CM.Glyphs.LRCornerDbl
  576. }";
  577. var wizard = new Wizard { Title = title, Width = width, Height = height };
  578. RunState runstate = Application.Begin (wizard);
  579. // TODO: Disabled until Dim.Auto is used in Dialog
  580. //TestHelpers.AssertDriverContentsWithFrameAre (
  581. // $"{topRow}\n{row2}\n{row3}\n{separatorRow}\n{buttonRow}\n{bottomRow}",
  582. // _output
  583. // );
  584. Application.End (runstate);
  585. wizard.Dispose ();
  586. }
  587. }