Skip to content

Commit 2778482

Browse files
committed
Remove InitFakeDriver.
1 parent 2bb057e commit 2778482

File tree

1 file changed

+23
-73
lines changed

1 file changed

+23
-73
lines changed

UnitTests/Views/TabViewTests.cs

Lines changed: 23 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ public void AddTab_SameTabMoreThanOnce ()
1919
tv.AddTab (tab1, false);
2020

2121
Assert.Equal (2, tv.Tabs.Count);
22-
23-
// Shutdown must be called to safely clean up Application if Init has been called
24-
Application.Shutdown ();
2522
}
2623

2724
[Fact]
25+
[SetupFakeDriver]
2826
public void AddTwoTabs_SecondIsSelected ()
2927
{
30-
InitFakeDriver ();
31-
3228
var tv = new TabView ();
3329
Tab tab1;
3430
Tab tab2;
@@ -37,8 +33,6 @@ public void AddTwoTabs_SecondIsSelected ()
3733

3834
Assert.Equal (2, tv.Tabs.Count);
3935
Assert.Equal (tab2, tv.SelectedTab);
40-
41-
Application.Shutdown ();
4236
}
4337

4438
[Fact]
@@ -57,9 +51,6 @@ public void EnsureSelectedTabVisible_MustScroll ()
5751
// Asking to show tab2 should automatically move scroll offset accordingly
5852
tv.SelectedTab = tab2;
5953
Assert.Equal (1, tv.TabScrollOffset);
60-
61-
// Shutdown must be called to safely clean up Application if Init has been called
62-
Application.Shutdown ();
6354
}
6455

6556
[Fact]
@@ -76,8 +67,6 @@ public void EnsureSelectedTabVisible_NullSelect ()
7667

7768
Assert.Null (tv.SelectedTab);
7869
Assert.Equal (0, tv.TabScrollOffset);
79-
80-
Application.Shutdown ();
8170
}
8271

8372
[Fact]
@@ -98,16 +87,13 @@ public void EnsureValidScrollOffsets_TabScrollOffset ()
9887
tv.TabScrollOffset = -1;
9988
tv.SelectedTab = tab1;
10089
Assert.Equal (0, tv.TabScrollOffset);
101-
102-
// Shutdown must be called to safely clean up Application if Init has been called
103-
Application.Shutdown ();
10490
}
10591

10692
[Fact]
10793
[AutoInitShutdown]
10894
public void MouseClick_ChangesTab ()
10995
{
110-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
96+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
11197

11298
tv.Width = 20;
11399
tv.Height = 5;
@@ -190,7 +176,7 @@ public void MouseClick_ChangesTab ()
190176
[AutoInitShutdown]
191177
public void MouseClick_Right_Left_Arrows_ChangesTab ()
192178
{
193-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
179+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
194180

195181
tv.Width = 7;
196182
tv.Height = 5;
@@ -274,7 +260,7 @@ public void MouseClick_Right_Left_Arrows_ChangesTab ()
274260
[AutoInitShutdown]
275261
public void MouseClick_Right_Left_Arrows_ChangesTab_With_Border ()
276262
{
277-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
263+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
278264

279265
tv.Width = 9;
280266
tv.Height = 7;
@@ -365,7 +351,7 @@ public void MouseClick_Right_Left_Arrows_ChangesTab_With_Border ()
365351
}
366352

367353
[Fact]
368-
[SetupFakeDriver]
354+
[AutoInitShutdown]
369355
public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp_F6 ()
370356
{
371357
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
@@ -541,9 +527,6 @@ public void RemoveAllTabs_ClearsSelection ()
541527
tv.RemoveTab (tab2);
542528

543529
Assert.Null (tv.SelectedTab);
544-
545-
// Shutdown must be called to safely clean up Application if Init has been called
546-
Application.Shutdown ();
547530
}
548531

549532
[Fact]
@@ -555,9 +538,6 @@ public void RemoveTab_ChangesSelection ()
555538
tv.RemoveTab (tab1);
556539

557540
Assert.Equal (tab2, tv.SelectedTab);
558-
559-
// Shutdown must be called to safely clean up Application if Init has been called
560-
Application.Shutdown ();
561541
}
562542

563543
[Fact]
@@ -575,9 +555,6 @@ public void RemoveTab_MultipleCalls_NotAnError ()
575555
tv.RemoveTab (tab1);
576556

577557
Assert.Equal (tab2, tv.SelectedTab);
578-
579-
// Shutdown must be called to safely clean up Application if Init has been called
580-
Application.Shutdown ();
581558
}
582559

583560
[Fact]
@@ -603,16 +580,13 @@ public void SelectedTabChanged_Called ()
603580
Assert.Equal (1, called);
604581
Assert.Equal (tab1, oldTab);
605582
Assert.Equal (tab2, newTab);
606-
607-
// Shutdown must be called to safely clean up Application if Init has been called
608-
Application.Shutdown ();
609583
}
610584

611585
[Fact]
612586
[SetupFakeDriver]
613587
public void ShowTopLine_False_TabsOnBottom_False_TestTabView_Width3 ()
614588
{
615-
TabView tv = GetTabView (out _, out _, false);
589+
TabView tv = GetTabView (out _, out _);
616590
tv.Width = 3;
617591
tv.Height = 5;
618592
tv.Style = new () { ShowTopLine = false };
@@ -636,7 +610,7 @@ public void ShowTopLine_False_TabsOnBottom_False_TestTabView_Width3 ()
636610
[SetupFakeDriver]
637611
public void ShowTopLine_False_TabsOnBottom_False_TestTabView_Width4 ()
638612
{
639-
TabView tv = GetTabView (out _, out _, false);
613+
TabView tv = GetTabView (out _, out _);
640614
tv.Width = 4;
641615
tv.Height = 5;
642616
tv.Style = new () { ShowTopLine = false };
@@ -660,7 +634,7 @@ public void ShowTopLine_False_TabsOnBottom_False_TestTabView_Width4 ()
660634
[SetupFakeDriver]
661635
public void ShowTopLine_False_TabsOnBottom_False_TestThinTabView_WithLongNames ()
662636
{
663-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
637+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
664638
tv.Width = 10;
665639
tv.Height = 5;
666640
tv.Style = new () { ShowTopLine = false };
@@ -759,7 +733,7 @@ public void ShowTopLine_False_TabsOnBottom_False_TestThinTabView_WithLongNames (
759733
[SetupFakeDriver]
760734
public void ShowTopLine_False_TabsOnBottom_True_TestTabView_Width3 ()
761735
{
762-
TabView tv = GetTabView (out _, out _, false);
736+
TabView tv = GetTabView (out _, out _);
763737
tv.Width = 3;
764738
tv.Height = 5;
765739
tv.Style = new () { ShowTopLine = false, TabsOnBottom = true };
@@ -783,7 +757,7 @@ public void ShowTopLine_False_TabsOnBottom_True_TestTabView_Width3 ()
783757
[SetupFakeDriver]
784758
public void ShowTopLine_False_TabsOnBottom_True_TestTabView_Width4 ()
785759
{
786-
TabView tv = GetTabView (out _, out _, false);
760+
TabView tv = GetTabView (out _, out _);
787761
tv.Width = 4;
788762
tv.Height = 5;
789763
tv.Style = new () { ShowTopLine = false, TabsOnBottom = true };
@@ -807,7 +781,7 @@ public void ShowTopLine_False_TabsOnBottom_True_TestTabView_Width4 ()
807781
[SetupFakeDriver]
808782
public void ShowTopLine_False_TabsOnBottom_True_TestThinTabView_WithLongNames ()
809783
{
810-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
784+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
811785
tv.Width = 10;
812786
tv.Height = 5;
813787
tv.Style = new () { ShowTopLine = false, TabsOnBottom = true };
@@ -908,7 +882,7 @@ public void ShowTopLine_False_TabsOnBottom_True_TestThinTabView_WithLongNames ()
908882
[SetupFakeDriver]
909883
public void ShowTopLine_True_TabsOnBottom_False_TestTabView_Width3 ()
910884
{
911-
TabView tv = GetTabView (out _, out _, false);
885+
TabView tv = GetTabView (out _, out _);
912886
tv.Width = 3;
913887
tv.Height = 5;
914888
tv.Layout ();
@@ -930,7 +904,7 @@ public void ShowTopLine_True_TabsOnBottom_False_TestTabView_Width3 ()
930904
[SetupFakeDriver]
931905
public void ShowTopLine_True_TabsOnBottom_False_TestTabView_Width4 ()
932906
{
933-
TabView tv = GetTabView (out _, out _, false);
907+
TabView tv = GetTabView (out _, out _);
934908
tv.Width = 4;
935909
tv.Height = 5;
936910
tv.Layout ();
@@ -953,7 +927,7 @@ public void ShowTopLine_True_TabsOnBottom_False_TestTabView_Width4 ()
953927
[SetupFakeDriver]
954928
public void ShowTopLine_True_TabsOnBottom_False_TestThinTabView_WithLongNames ()
955929
{
956-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
930+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
957931
tv.Width = 10;
958932
tv.Height = 5;
959933

@@ -1050,7 +1024,7 @@ public void ShowTopLine_True_TabsOnBottom_False_TestThinTabView_WithLongNames ()
10501024
[SetupFakeDriver]
10511025
public void ShowTopLine_True_TabsOnBottom_False_With_Unicode ()
10521026
{
1053-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
1027+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
10541028
tv.Width = 20;
10551029
tv.Height = 5;
10561030

@@ -1092,7 +1066,7 @@ public void ShowTopLine_True_TabsOnBottom_False_With_Unicode ()
10921066
[SetupFakeDriver]
10931067
public void ShowTopLine_True_TabsOnBottom_True_TestTabView_Width3 ()
10941068
{
1095-
TabView tv = GetTabView (out _, out _, false);
1069+
TabView tv = GetTabView (out _, out _);
10961070
tv.Width = 3;
10971071
tv.Height = 5;
10981072
tv.Style = new () { TabsOnBottom = true };
@@ -1116,7 +1090,7 @@ public void ShowTopLine_True_TabsOnBottom_True_TestTabView_Width3 ()
11161090
[SetupFakeDriver]
11171091
public void ShowTopLine_True_TabsOnBottom_True_TestTabView_Width4 ()
11181092
{
1119-
TabView tv = GetTabView (out _, out _, false);
1093+
TabView tv = GetTabView (out _, out _);
11201094
tv.Width = 4;
11211095
tv.Height = 5;
11221096
tv.Style = new () { TabsOnBottom = true };
@@ -1140,7 +1114,7 @@ public void ShowTopLine_True_TabsOnBottom_True_TestTabView_Width4 ()
11401114
[SetupFakeDriver]
11411115
public void ShowTopLine_True_TabsOnBottom_True_TestThinTabView_WithLongNames ()
11421116
{
1143-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
1117+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
11441118
tv.Width = 10;
11451119
tv.Height = 5;
11461120
tv.Style = new () { TabsOnBottom = true };
@@ -1222,7 +1196,7 @@ public void ShowTopLine_True_TabsOnBottom_True_TestThinTabView_WithLongNames ()
12221196
[SetupFakeDriver]
12231197
public void ShowTopLine_True_TabsOnBottom_True_With_Unicode ()
12241198
{
1225-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
1199+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
12261200
tv.Width = 20;
12271201
tv.Height = 5;
12281202
tv.Style = new () { TabsOnBottom = true };
@@ -1294,9 +1268,6 @@ public void SwitchTabBy_NormalUsage ()
12941268
// even though we go right 2 indexes the event should only be called once
12951269
Assert.Equal (1, called);
12961270
Assert.Equal (tab4, tv.SelectedTab);
1297-
1298-
// Shutdown must be called to safely clean up Application if Init has been called
1299-
Application.Shutdown ();
13001271
}
13011272

13021273
[Fact]
@@ -1312,9 +1283,6 @@ public void SwitchTabBy_OutOfTabsRange ()
13121283
tv.SwitchTabBy (-500);
13131284

13141285
Assert.Equal (tab1, tv.SelectedTab);
1315-
1316-
// Shutdown must be called to safely clean up Application if Init has been called
1317-
Application.Shutdown ();
13181286
}
13191287

13201288
[Fact]
@@ -1333,16 +1301,13 @@ public void RemoveTab_ThatHasFocus ()
13331301
}
13341302

13351303
Assert.Empty (tv.Tabs);
1336-
1337-
// Shutdown must be called to safely clean up Application if Init has been called
1338-
Application.Shutdown ();
13391304
}
13401305

13411306
[Fact]
13421307
[SetupFakeDriver]
13431308
public void Add_Three_TabsOnTop_ChangesTab ()
13441309
{
1345-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
1310+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
13461311
Tab tab3;
13471312

13481313
tv.AddTab (
@@ -1407,7 +1372,7 @@ public void Add_Three_TabsOnTop_ChangesTab ()
14071372
[SetupFakeDriver]
14081373
public void Add_Three_TabsOnBottom_ChangesTab ()
14091374
{
1410-
TabView tv = GetTabView (out Tab tab1, out Tab tab2, false);
1375+
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
14111376
Tab tab3;
14121377

14131378
tv.AddTab (
@@ -1471,7 +1436,7 @@ public void Add_Three_TabsOnBottom_ChangesTab ()
14711436
}
14721437

14731438
[Fact]
1474-
[SetupFakeDriver]
1439+
[AutoInitShutdown]
14751440
public void Tab_Get_Focus_By_Press_F6 ()
14761441
{
14771442
TabView tv = GetTabView (out Tab tab1, out Tab tab2);
@@ -1521,13 +1486,8 @@ public void Mouse_Wheel_Changes_Tab ()
15211486

15221487
private TabView GetTabView () { return GetTabView (out _, out _); }
15231488

1524-
private TabView GetTabView (out Tab tab1, out Tab tab2, bool initFakeDriver = true)
1489+
private TabView GetTabView (out Tab tab1, out Tab tab2)
15251490
{
1526-
if (initFakeDriver)
1527-
{
1528-
InitFakeDriver ();
1529-
}
1530-
15311491
var tv = new TabView () { Id = "tv " };
15321492
tv.BeginInit ();
15331493
tv.EndInit ();
@@ -1541,14 +1501,4 @@ private TabView GetTabView (out Tab tab1, out Tab tab2, bool initFakeDriver = tr
15411501

15421502
return tv;
15431503
}
1544-
1545-
private void InitFakeDriver ()
1546-
{
1547-
ConfigurationManager.Locations = ConfigLocations.Default;
1548-
ConfigurationManager.Reset ();
1549-
1550-
var driver = new FakeDriver ();
1551-
Application.Init (driver);
1552-
driver.Init ();
1553-
}
15541504
}

0 commit comments

Comments
 (0)