Skip to content

Commit

Permalink
Merge pull request TestStack#236 from eric-winkler/FilenameLengthCrash
Browse files Browse the repository at this point in the history
Bugfix: Allow support for screen types with extremely long full type names
  • Loading branch information
JakeGinnivan committed Mar 30, 2014
2 parents f3c216c + fe4b2d2 commit 5fa36b4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TestStack.White.ScreenObjects/ScreenRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void ClearClosedScreens()

private static InitializeOption IdentifiedOption<T>(InitializeOption option)
{
return option.AndIdentifiedBy(typeof (T).FullName);
return option.AndIdentifiedBy(typeof (T).GUID.ToString());
}

private T GetScreen<T>(Window window) where T : AppScreen
Expand Down
41 changes: 41 additions & 0 deletions src/TestStack.White.UITests/GenericScreenTypeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Collections.Generic;
using TestStack.White.Factory;
using TestStack.White.ScreenObjects;
using TestStack.White.UIItems;
using TestStack.White.UIItems.Finders;
using TestStack.White.UIItems.WindowItems;

namespace TestStack.White.UITests
{
public class GenericScreenTypeTest : WhiteTestBase
{
protected override void ExecuteTestRun(WindowsFramework framework)
{
var screen = Repository.Get<SomeGenericScreen<int, int>>(MainWindow.Title, InitializeOption.NoCache);
screen.MakeWindowItemsMapDirty();
Application.ApplicationSession.Save();
}

protected override IEnumerable<WindowsFramework> SupportedFrameworks()
{
yield return WindowsFramework.WinForms;
yield return WindowsFramework.Wpf;
}

private class SomeGenericScreen<T1, T2> : AppScreen
{
private readonly Window window;

public SomeGenericScreen(Window window, ScreenRepository screenRepository)
: base(window, screenRepository)
{
this.window = window;
}

public virtual void MakeWindowItemsMapDirty()
{
window.Get(SearchCriteria.All);
}
}
}
}
1 change: 1 addition & 0 deletions src/TestStack.White.UITests/TestStack.White.UITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<Compile Include="ControlTests\ProgressBarTest.cs" />
<Compile Include="ControlTests\WindowStripControls\StatusBarTest.cs" />
<Compile Include="ControlTests\WindowStripControls\StatusStripTest.cs" />
<Compile Include="GenericScreenTypeTest.cs" />
<Compile Include="Reporting\One.cs" />
<Compile Include="Reporting\SessionReportTest.cs" />
<Compile Include="Reporting\SubFlowsTest.cs" />
Expand Down

0 comments on commit 5fa36b4

Please sign in to comment.