Skip to content

Commit

Permalink
Merge branch 'rank_detection'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Zeier committed Dec 5, 2015
2 parents 2cb7881 + 0b6da8f commit 7d89a71
Show file tree
Hide file tree
Showing 95 changed files with 27,381 additions and 150 deletions.
142 changes: 141 additions & 1 deletion HDTTests/HDTTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
Expand Down Expand Up @@ -68,11 +69,12 @@
<Compile Include="Hearthstone\DeckTest.cs" />
<Compile Include="Hearthstone\CardDbTest.cs" />
<Compile Include="LogReader\ArenaHandlerTest.cs" />
<Compile Include="LogReader\AssetHandlerTest.cs" />
<Compile Include="LogReader\BobHandlerTest.cs" />
<Compile Include="LogReader\PowerHandlerTest.cs" />
<Compile Include="LogReader\LogReaderTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RankedDetection\RankedDetectionMenuTest.cs" />
<Compile Include="RankedDetection\RankedDetectionTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hearthstone Deck Tracker\Hearthstone Deck Tracker.csproj">
Expand All @@ -82,6 +84,144 @@
</ItemGroup>
<ItemGroup>
<Content Include="LogReader\TestFiles\ExampleBobLogLines.txt" />
<Content Include="RankedDetection\TestFiles\1.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\10.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\11.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\12.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\13.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\14.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\15.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\16-9_Menus_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\16-9_Menus_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\16.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\17.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\18.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\19.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\20.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\21.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\22.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\23.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\24.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\25.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\3.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\4.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\5.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\6.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\7.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\8.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\9.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\AiMenu_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\AiMenu_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Arena_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Arena_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Brawl_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Brawl_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Collection_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Collection_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\legendA.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\legendB.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\legendC.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\legendD.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\MainMenu_16-9_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\MainMenu_16-9_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\MainMenu_4-3_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\MainMenu_4-3_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\PlayMenu_Opp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\PlayMenu_Play.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="RankedDetection\TestFiles\Screen768_8-8.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
54 changes: 0 additions & 54 deletions HDTTests/LogReader/AssetHandlerTest.cs

This file was deleted.

73 changes: 73 additions & 0 deletions HDTTests/RankedDetection/RankedDetectionMenuTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System.Drawing;
using Hearthstone_Deck_Tracker.Utility;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace HDTTests.RankedDetection
{
[TestClass]
public class RankedDetectionMenuTest
{
// Test all menus fail (due to how legend detect works)

[TestMethod]
public void AllMenus_16_9() // at 16:9 area is same for all menus
{
Assert.IsTrue(MenuFails("16-9_Menus"));
}

[TestMethod]
public void AiMenu()
{
Assert.IsTrue(MenuFails("AiMenu"));
}

[TestMethod]
public void ArenaMenu()
{
Assert.IsTrue(MenuFails("Arena"));
}

[TestMethod]
public void BrawlMenu()
{
Assert.IsTrue(MenuFails("Brawl"));
}

[TestMethod]
public void CollectionMenu()
{
Assert.IsTrue(MenuFails("Collection"));
}

[TestMethod]
public void PlayMenu()
{
Assert.IsTrue(MenuFails("PlayMenu"));
}

[TestMethod]
public void MainMenu_16_9()
{
Assert.IsTrue(MenuFails("MainMenu_16-9"));
}

[TestMethod]
public void MainMenu_4_3()
{
Assert.IsTrue(MenuFails("MainMenu_4-3"));
}

// Helper methods

private bool MenuFails(string name)
{
var testFiles = "RankedDetection/TestFiles/";
var bmp = new Bitmap(testFiles + name + "_Opp.png");
var opp = RankDetection.FindBest(bmp);
bmp = new Bitmap(testFiles + name + "_Play.png");
var play = RankDetection.FindBest(bmp);

return opp == -1 && play == -1;
}
}
}
Loading

0 comments on commit 7d89a71

Please sign in to comment.