Skip to content

Commit 5fa36b4

Browse files
committed
Merge pull request #236 from eric-winkler/FilenameLengthCrash
Bugfix: Allow support for screen types with extremely long full type names
2 parents f3c216c + fe4b2d2 commit 5fa36b4

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

src/TestStack.White.ScreenObjects/ScreenRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private void ClearClosedScreens()
107107

108108
private static InitializeOption IdentifiedOption<T>(InitializeOption option)
109109
{
110-
return option.AndIdentifiedBy(typeof (T).FullName);
110+
return option.AndIdentifiedBy(typeof (T).GUID.ToString());
111111
}
112112

113113
private T GetScreen<T>(Window window) where T : AppScreen
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Collections.Generic;
2+
using TestStack.White.Factory;
3+
using TestStack.White.ScreenObjects;
4+
using TestStack.White.UIItems;
5+
using TestStack.White.UIItems.Finders;
6+
using TestStack.White.UIItems.WindowItems;
7+
8+
namespace TestStack.White.UITests
9+
{
10+
public class GenericScreenTypeTest : WhiteTestBase
11+
{
12+
protected override void ExecuteTestRun(WindowsFramework framework)
13+
{
14+
var screen = Repository.Get<SomeGenericScreen<int, int>>(MainWindow.Title, InitializeOption.NoCache);
15+
screen.MakeWindowItemsMapDirty();
16+
Application.ApplicationSession.Save();
17+
}
18+
19+
protected override IEnumerable<WindowsFramework> SupportedFrameworks()
20+
{
21+
yield return WindowsFramework.WinForms;
22+
yield return WindowsFramework.Wpf;
23+
}
24+
25+
private class SomeGenericScreen<T1, T2> : AppScreen
26+
{
27+
private readonly Window window;
28+
29+
public SomeGenericScreen(Window window, ScreenRepository screenRepository)
30+
: base(window, screenRepository)
31+
{
32+
this.window = window;
33+
}
34+
35+
public virtual void MakeWindowItemsMapDirty()
36+
{
37+
window.Get(SearchCriteria.All);
38+
}
39+
}
40+
}
41+
}

src/TestStack.White.UITests/TestStack.White.UITests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<Compile Include="ControlTests\ProgressBarTest.cs" />
8686
<Compile Include="ControlTests\WindowStripControls\StatusBarTest.cs" />
8787
<Compile Include="ControlTests\WindowStripControls\StatusStripTest.cs" />
88+
<Compile Include="GenericScreenTypeTest.cs" />
8889
<Compile Include="Reporting\One.cs" />
8990
<Compile Include="Reporting\SessionReportTest.cs" />
9091
<Compile Include="Reporting\SubFlowsTest.cs" />

0 commit comments

Comments
 (0)