-
Notifications
You must be signed in to change notification settings - Fork 2
Passive Skill Tree Support #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
08f65ad
Adding Support for Deserializing the Passive Tree and Passive Tree Op…
EmmittJ 52ca373
Update PassiveTreeDeserializationTest.cs
EmmittJ 98b4791
Added Converters for PassiveNode and PassiveTree from Json Classes
EmmittJ 262f4f7
Fixed for a compulation error
EmmittJ aa435d9
Adding Tests for PassiveTree.Base
EmmittJ dd4868a
Adding MaxImageZoomLevel
EmmittJ 5dc5ead
Update JsonPassiveTree.cs
EmmittJ 7f313b1
Cleaned up classes and added Encode/Decode Build Url
EmmittJ c46917c
Added Tests for GameModel.PassiveTree.Options
EmmittJ c1bc961
Merge branch 'master' into passive-skill-tree
EmmittJ 0beb6e6
initial refactor for new passive tree json format (backwards compatible)
EmmittJ bd22568
Cleanup and added references to neighbor passive nodes and groups
EmmittJ d8fc8b1
Merge branch 'master' into passive-skill-tree
EmmittJ 0183432
Removed unused Realm.cs
EmmittJ ae7a706
Added `jewelSlots` to JsonPassiveTree. Updated OuterJewelSocket to Ex…
EmmittJ 95d5f4a
Updated JewelPassiveNodeIds to JewelSocketPassiveNodeIds to better re…
EmmittJ f629321
Added zoomLevel option when converting JsonPassiveNode to PassiveNode…
EmmittJ 193cef9
Updated ExpansionJewel to JsonExpansionJewelSocket to better represen…
EmmittJ e36db01
Removed duplicate TestCases on JsonPassiveNode_Arc
EmmittJ b81066e
Moved 3 PassiveTreeDeserializationTests to a new project PoESkillTree…
EmmittJ 9875ef9
Fixed an issue where JsonPassiveNode_Convert was failing because zoom…
EmmittJ 61b002f
Added PositionAtZoomLevel. JsonPassiveNode converted to PassiveNodeDe…
EmmittJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
PoESkillTree.Engine.GameModel.IntegrationTests/Data/skilltree_3.10.0.new.min.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
PoESkillTree.Engine.GameModel.IntegrationTests/Data/skilltree_3.10.0.old.min.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
PoESkillTree.Engine.GameModel.IntegrationTests/Data/skilltree_3.8.0.min.json
Large diffs are not rendered by default.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
PoESkillTree.Engine.GameModel.IntegrationTests/PassiveTree/PassiveTreeDeserializationTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using FluentAssertions; | ||
| using Newtonsoft.Json; | ||
| using NUnit.Framework; | ||
| using PoESkillTree.Engine.GameModel.PassiveTree.Base; | ||
|
|
||
| namespace PoESkillTree.Engine.GameModel.PassiveTree | ||
| { | ||
| [TestFixture] | ||
| public class PassiveTreeDeserializationTest | ||
| { | ||
| [TestCase("skilltree_3.10.0.new.min.json")] | ||
| [TestCase("skilltree_3.10.0.old.min.json")] | ||
| [TestCase("skilltree_3.8.0.min.json")] | ||
| public void JsonPassiveTree_Deserialization_Serialization_Deserialization(string fileName) | ||
| { | ||
| var orignalJson = TestUtils.ReadDataFile(fileName); | ||
| Assert.IsNotEmpty(orignalJson); | ||
|
|
||
| var deserialized1 = JsonConvert.DeserializeObject<JsonPassiveTree>(orignalJson); | ||
| var serialized1 = JsonConvert.SerializeObject(deserialized1); | ||
| Assert.IsNotEmpty(serialized1); | ||
|
|
||
| var deserialized2 = JsonConvert.DeserializeObject<JsonPassiveTree>(serialized1); | ||
| var serialized2 = JsonConvert.SerializeObject(deserialized2); | ||
| Assert.IsNotEmpty(serialized2); | ||
|
|
||
| serialized1.Should().BeEquivalentTo(serialized2); | ||
| } | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
...e.Engine.GameModel.IntegrationTests/PoESkillTree.Engine.GameModel.IntegrationTests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <RootNamespace>PoESkillTree.Engine.GameModel</RootNamespace> | ||
| <TargetFramework>netcoreapp3.1</TargetFramework> | ||
| <LangVersion>8</LangVersion> | ||
| <AssemblyTitle>PoESkillTree.Engine.GameModel.IntegrationTests</AssemblyTitle> | ||
| <Product>PoESkillTree.Engine.GameModel.IntegrationTests</Product> | ||
| <Copyright>Copyright © 2018</Copyright> | ||
| <IsPackable>False</IsPackable> | ||
| <Nullable>enable</Nullable> | ||
| <WarningsAsErrors>8600;8601;8602;8603;8604;8619;8620</WarningsAsErrors> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="FluentAssertions" Version="5.9.0" /> | ||
| <PackageReference Include="Moq" Version="4.13.1" /> | ||
| <PackageReference Include="morelinq" Version="3.2.0" /> | ||
| <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> | ||
| <PackageReference Include="NUnit" Version="3.12.0" /> | ||
| <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <None Include="Data\*.json"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ProjectReference Include="..\PoESkillTree.Engine.GameModel\PoESkillTree.Engine.GameModel.csproj" /> | ||
| <ProjectReference Include="..\PoESkillTree.Engine.Utils\PoESkillTree.Engine.Utils.csproj" /> | ||
| </ItemGroup> | ||
| </Project> |
14 changes: 14 additions & 0 deletions
14
PoESkillTree.Engine.GameModel.IntegrationTests/TestUtils.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| using System.IO; | ||
| using NUnit.Framework; | ||
|
|
||
| namespace PoESkillTree.Engine.GameModel | ||
| { | ||
| public static class TestUtils | ||
| { | ||
| public static string ReadDataFile(string fileName) | ||
| => File.ReadAllText(GetDataFilePath(fileName)); | ||
|
|
||
| public static string GetDataFilePath(string filename) | ||
| => TestContext.CurrentContext.TestDirectory + "/Data/" + filename; | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
PoESkillTree.Engine.GameModel.Tests/PassiveTree/Base/JsonPassiveNodeGroupTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using NUnit.Framework; | ||
|
|
||
| namespace PoESkillTree.Engine.GameModel.PassiveTree.Base | ||
| { | ||
| public class JsonPassiveNodeGroupTest | ||
| { | ||
| [TestCase(0, 0, 0.3835f)] | ||
| [TestCase(0, 1, 0.3835f)] | ||
| [TestCase(1, 0, 0.3835f)] | ||
| [TestCase(1, 1, 0.3835f)] | ||
| public void JsonPassiveNodeGroup_Position(float x, float y, float zoomLevel) | ||
| { | ||
| var group = new JsonPassiveNodeGroup() | ||
| { | ||
| OriginalX = x, | ||
| OriginalY = y, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| Assert.AreEqual(x * zoomLevel, group.Position.X); | ||
| Assert.AreEqual(y * zoomLevel, group.Position.Y); | ||
| } | ||
| } | ||
| } |
183 changes: 183 additions & 0 deletions
183
PoESkillTree.Engine.GameModel.Tests/PassiveTree/Base/JsonPassiveNodeTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| using NUnit.Framework; | ||
| using System; | ||
|
|
||
| namespace PoESkillTree.Engine.GameModel.PassiveTree.Base | ||
| { | ||
| public class JsonPassiveNodeTest | ||
| { | ||
| [TestCase(CharacterClass.Scion)] | ||
| [TestCase(CharacterClass.Marauder)] | ||
| [TestCase(CharacterClass.Ranger)] | ||
| [TestCase(CharacterClass.Witch)] | ||
| [TestCase(CharacterClass.Duelist)] | ||
| [TestCase(CharacterClass.Templar)] | ||
| [TestCase(CharacterClass.Shadow)] | ||
| [TestCase(null)] | ||
| public void JsonPassiveNode_StartingCharacterClass(CharacterClass? characterClass) | ||
| { | ||
| var node = new JsonPassiveNode() | ||
| { | ||
| StartingCharacterClass = characterClass | ||
| }; | ||
|
|
||
| Assert.AreEqual(characterClass.HasValue, node.IsRootNode); | ||
| Assert.AreEqual(characterClass, node.StartingCharacterClass); | ||
| } | ||
|
|
||
| [TestCase("", ExpectedResult = false)] | ||
| [TestCase("testing", ExpectedResult = true)] | ||
| public bool JsonPassiveNode_IsAscendancyNode(string ascendancyName) | ||
| { | ||
| var node = new JsonPassiveNode | ||
| { | ||
| AscendancyName = ascendancyName | ||
| }; | ||
|
|
||
| return node.IsAscendancyNode; | ||
| } | ||
|
|
||
| [TestCase(PassiveNodeType.Keystone, ExpectedResult = PassiveNodeType.Keystone)] | ||
| [TestCase(PassiveNodeType.Mastery, ExpectedResult = PassiveNodeType.Mastery)] | ||
| [TestCase(PassiveNodeType.Notable, ExpectedResult = PassiveNodeType.Notable)] | ||
| [TestCase(PassiveNodeType.JewelSocket, ExpectedResult = PassiveNodeType.JewelSocket)] | ||
| [TestCase(PassiveNodeType.Small, ExpectedResult = PassiveNodeType.Small)] | ||
| [TestCase(PassiveNodeType.Keystone | PassiveNodeType.Mastery | PassiveNodeType.Notable | PassiveNodeType.JewelSocket | PassiveNodeType.Small, ExpectedResult = PassiveNodeType.Small)] | ||
| [TestCase(42, ExpectedResult = PassiveNodeType.Small)] | ||
| public PassiveNodeType JsonPassiveNode_PassiveNodeType(PassiveNodeType passiveNodeType) | ||
| { | ||
| var node = new JsonPassiveNode | ||
| { | ||
| IsKeystone = passiveNodeType == PassiveNodeType.Keystone, | ||
| IsMastery = passiveNodeType == PassiveNodeType.Mastery, | ||
| IsNotable = passiveNodeType == PassiveNodeType.Notable, | ||
| IsJewelSocket = passiveNodeType == PassiveNodeType.JewelSocket, | ||
| }; | ||
|
|
||
| return node.PassiveNodeType; | ||
| } | ||
|
|
||
| [TestCase(0, new[] { 1f })] | ||
| [TestCase(1, new[] { 1f, 2f })] | ||
| public void JsonPassiveNode_Arc(int skillsPerOrbitIndex, float[] skillsPerOrbit) | ||
| { | ||
| var node = new JsonPassiveNode | ||
| { | ||
| SkillsPerOrbitIndex = skillsPerOrbitIndex, | ||
| SkillsPerOrbit = skillsPerOrbit, | ||
| }; | ||
|
|
||
| Assert.AreEqual(2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex], node.Arc); | ||
| } | ||
|
|
||
| [TestCase(0, 0, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(0, 1, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(1, 0, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(1, 1, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(500, 250, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 500, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(500, 500, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 250, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 250, 0.3835f, 0, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| public void JsonPassiveNode_Position(float x, float y, float zoomLevel, int orbitRadiiIndex, float[] orbitRadii, int skillsPerOrbitIndex, float[] skillsPerOrbit) | ||
| { | ||
| var group = new JsonPassiveNodeGroup | ||
| { | ||
| OriginalX = x, | ||
| OriginalY = y, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| var node = new JsonPassiveNode | ||
| { | ||
| PassiveNodeGroup = group, | ||
| OrbitRadiiIndex = orbitRadiiIndex, | ||
| OrbitRadii = orbitRadii, | ||
| SkillsPerOrbitIndex = skillsPerOrbitIndex, | ||
| SkillsPerOrbit = skillsPerOrbit, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| Assert.AreEqual(group.Position.X - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Sin(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.X); | ||
| Assert.AreEqual(group.Position.Y - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Cos(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.Y); | ||
| } | ||
|
|
||
| [TestCase(0, 0, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(0, 1, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(1, 0, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(1, 1, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(500, 250, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 500, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(500, 500, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 250, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 250, 0.3835f, 0, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| public void JsonPassiveNode_Convert(float _x, float _y, float zoomLevel, int orbitRadiiIndex, float[] orbitRadii, int skillsPerOrbitIndex, float[] skillsPerOrbit) | ||
| { | ||
| var group = new JsonPassiveNodeGroup | ||
| { | ||
| OriginalX = _x, | ||
| OriginalY = _y, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| var node = new JsonPassiveNode | ||
| { | ||
| PassiveNodeGroup = group, | ||
| OrbitRadiiIndex = orbitRadiiIndex, | ||
| OrbitRadii = orbitRadii, | ||
| SkillsPerOrbitIndex = skillsPerOrbitIndex, | ||
| SkillsPerOrbit = skillsPerOrbit, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| var nodeDefinition = PassiveNodeDefinition.Convert(node); | ||
| var nodePosition = node.PositionAtZoomLevel(1f); | ||
| Assert.AreEqual(nodePosition.X, nodeDefinition.Position.X); | ||
| Assert.AreEqual(nodePosition.Y, nodeDefinition.Position.Y); | ||
| } | ||
|
|
||
| [TestCase(0, 0, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(0, 1, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(1, 0, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(1, 1, 0.3835f, 0, new[] { 0f }, 0, new[] { 1f })] | ||
| [TestCase(500, 250, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 500, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(500, 500, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 250, 0.3835f, 1, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| [TestCase(250, 250, 0.3835f, 0, new[] { 0f, 82f }, 1, new[] { 1f, 2f })] | ||
| public void JsonPassiveNode_ClearPosition(float x, float y, float zoomLevel, int orbitRadiiIndex, float[] orbitRadii, int skillsPerOrbitIndex, float[] skillsPerOrbit) | ||
| { | ||
| var group = new JsonPassiveNodeGroup | ||
| { | ||
| OriginalX = x, | ||
| OriginalY = y, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| var node = new JsonPassiveNode | ||
| { | ||
| PassiveNodeGroup = group, | ||
| OrbitRadiiIndex = orbitRadiiIndex, | ||
| OrbitRadii = orbitRadii, | ||
| SkillsPerOrbitIndex = skillsPerOrbitIndex, | ||
| SkillsPerOrbit = skillsPerOrbit, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| Assert.AreEqual(group.Position.X - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Sin(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.X); | ||
| Assert.AreEqual(group.Position.Y - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Cos(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.Y); | ||
|
|
||
| var newGroup = new JsonPassiveNodeGroup | ||
| { | ||
| OriginalX = x * 10, | ||
| OriginalY = y * 10, | ||
| ZoomLevel = zoomLevel, | ||
| }; | ||
|
|
||
| node.PassiveNodeGroup = newGroup; | ||
| node.ClearPositionCache(); | ||
|
|
||
| Assert.AreEqual(newGroup.Position.X - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Sin(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.X); | ||
| Assert.AreEqual(newGroup.Position.Y - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Cos(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.Y); | ||
| } | ||
| } | ||
| } | ||
88 changes: 88 additions & 0 deletions
88
PoESkillTree.Engine.GameModel.Tests/PassiveTree/Base/JsonPassiveTreeAscendancyClassTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| using Newtonsoft.Json; | ||
| using NUnit.Framework; | ||
| using System.Drawing; | ||
|
|
||
| namespace PoESkillTree.Engine.GameModel.PassiveTree.Base | ||
| { | ||
| public class JsonPassiveTreeAscendancyClassTest | ||
| { | ||
| [TestCase(25f, 25f, 50f, 50f)] | ||
| [TestCase(0.25f, 0.50f, 150f, 50f)] | ||
| [TestCase(0.50f, 0.25f, 100f, 50f)] | ||
| public void JsonAscendancyClassOption_FlavourTextBounds(float x, float y, float width, float height) | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{\"flavourTextRect\": {{ \"x\": {x},\"y\": {y},\"width\": {width},\"height\": {height} }}}}"); | ||
|
|
||
| Assert.AreEqual(x, ascendancy.FlavourTextBounds.X); | ||
| Assert.AreEqual(y, ascendancy.FlavourTextBounds.Y); | ||
| Assert.AreEqual(width, ascendancy.FlavourTextBounds.Width); | ||
| Assert.AreEqual(height, ascendancy.FlavourTextBounds.Height); | ||
| } | ||
|
|
||
| [TestCase(25f, 25f, 50f, 50f)] | ||
| [TestCase(0.25f, 0.50f, 150f, 50f)] | ||
| [TestCase(0.50f, 0.25f, 100f, 50f)] | ||
| public void JsonAscendancyClassOption_FlavourTextBounds_Old(float x, float y, float width, float height) | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{\"flavourTextRect\": \"{x},{y},{width},{height}\" }}"); | ||
|
|
||
| Assert.AreEqual(x, ascendancy.FlavourTextBounds.X); | ||
| Assert.AreEqual(y, ascendancy.FlavourTextBounds.Y); | ||
| Assert.AreEqual(width, ascendancy.FlavourTextBounds.Width); | ||
| Assert.AreEqual(height, ascendancy.FlavourTextBounds.Height); | ||
| } | ||
|
|
||
| [Test] | ||
| public void JsonAscendancyClassOption_FlavourTextBounds_Empty() | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{ \"flavourTextRect\": {{ }} }}"); | ||
|
|
||
| Assert.AreEqual(RectangleF.Empty, ascendancy.FlavourTextBounds); | ||
| } | ||
|
|
||
| [TestCase("50,50,50,50,50")] | ||
| [TestCase("50,50,50")] | ||
| [TestCase("50,50")] | ||
| [TestCase("50")] | ||
| [TestCase("")] | ||
| public void JsonAscendancyClassOption_FlavourTextBounds_Empty_Old(string boundsString) | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{\"flavourTextRect\": \"{boundsString}\" }}"); | ||
|
|
||
| Assert.AreEqual(RectangleF.Empty, ascendancy.FlavourTextBounds); | ||
| } | ||
|
|
||
| [TestCase("128,128,128")] | ||
| [TestCase("128128")] | ||
| [TestCase("128")] | ||
| public void JsonAscendancyClassOption_FlavourTextColour_IsNotEmpty(string colourString) | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{\"flavourTextColour\": \"{colourString}\" }}"); | ||
|
|
||
| Assert.AreNotEqual(Color.Empty, ascendancy.FlavourTextColour); | ||
| } | ||
|
|
||
| [TestCase(128, 128, 128)] | ||
| [TestCase(128, 128, 128)] | ||
| [TestCase(128, 128, 128)] | ||
| public void JsonAscendancyClassOption_FlavourTextColour_Old(byte red, byte green, byte blue) | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{\"flavourTextColour\": \"{red},{green},{blue}\" }}"); | ||
|
|
||
| Assert.IsNotNull(ascendancy.FlavourTextColour); | ||
| Assert.AreEqual(red, ascendancy.FlavourTextColour.R); | ||
| Assert.AreEqual(green, ascendancy.FlavourTextColour.G); | ||
| Assert.AreEqual(blue, ascendancy.FlavourTextColour.B); | ||
| } | ||
|
|
||
| [TestCase("128,128,128,128")] | ||
| [TestCase("128,128")] | ||
| [TestCase("")] | ||
| public void JsonAscendancyClassOption_FlavourTextColour_IsEmpty(string colourString) | ||
| { | ||
| var ascendancy = JsonConvert.DeserializeObject<JsonPassiveTreeAscendancyClass>($"{{\"flavourTextColour\": \"{colourString}\" }}"); | ||
|
|
||
| Assert.AreEqual(Color.Empty, ascendancy.FlavourTextColour); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.