-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Character portrait conversion (#1259) #minor
closes #529 --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
90c6cc4
commit a65c038
Showing
77 changed files
with
2,409 additions
and
1,605 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
55 changes: 55 additions & 0 deletions
55
ImperatorToCK3.UnitTests/CommonUtils/Genes/AccessoryGeneTemplateTests.cs
This file contains 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,55 @@ | ||
using commonItems; | ||
using ImperatorToCK3.CommonUtils.Genes; | ||
using Xunit; | ||
|
||
namespace ImperatorToCK3.UnitTests.CommonUtils.Genes; | ||
|
||
public class AccessoryGeneTemplateTests { | ||
[Fact] | ||
public void AgeSexWeightBlocksDefaultsToEmpty() { | ||
var reader = new BufferedReader( | ||
"= {}" | ||
); | ||
var geneTemplate = new AccessoryGeneTemplate("test_template", reader); | ||
|
||
Assert.Empty(geneTemplate.AgeSexWeightBlocks); | ||
} | ||
|
||
[Fact] | ||
public void AgeSexWeightBlocksCanBeLoaded() { | ||
var reader = new BufferedReader( | ||
"={\n" + | ||
"male={}\n" + | ||
"female={}\n" + | ||
"boy=male\n" + | ||
"girl=female\n" + | ||
"}" | ||
); | ||
var geneTemplate = new AccessoryGeneTemplate("test_template", reader); | ||
|
||
Assert.Equal(4, geneTemplate.AgeSexWeightBlocks.Count); | ||
} | ||
|
||
[Fact] | ||
public void AgeSexWithBlocksAreProperlyCopied() { | ||
var reader = new BufferedReader( | ||
"=\n" + | ||
"{\n" + | ||
"male={ 6 = hoodie 8 = trousers }\n" + | ||
"female={ 4 = skirt 6 = top }\n" + | ||
"boy=male\n" + | ||
"girl=female\n" + | ||
"}" | ||
); | ||
var geneTemplate = new AccessoryGeneTemplate("test_template", reader); | ||
|
||
Assert.Equal((uint)6, geneTemplate.AgeSexWeightBlocks["male"].GetAbsoluteWeight("hoodie")); | ||
Assert.Equal((uint)8, geneTemplate.AgeSexWeightBlocks["male"].GetAbsoluteWeight("trousers")); | ||
Assert.Equal((uint)4, geneTemplate.AgeSexWeightBlocks["female"].GetAbsoluteWeight("skirt")); | ||
Assert.Equal((uint)6, geneTemplate.AgeSexWeightBlocks["female"].GetAbsoluteWeight("top")); | ||
Assert.Equal((uint)6, geneTemplate.AgeSexWeightBlocks["boy"].GetAbsoluteWeight("hoodie")); | ||
Assert.Equal((uint)8, geneTemplate.AgeSexWeightBlocks["boy"].GetAbsoluteWeight("trousers")); | ||
Assert.Equal((uint)4, geneTemplate.AgeSexWeightBlocks["girl"].GetAbsoluteWeight("skirt")); | ||
Assert.Equal((uint)6, geneTemplate.AgeSexWeightBlocks["girl"].GetAbsoluteWeight("top")); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
ImperatorToCK3.UnitTests/CommonUtils/Genes/AccessoryGeneTests.cs
This file contains 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,79 @@ | ||
using commonItems; | ||
using ImperatorToCK3.CommonUtils.Genes; | ||
using Xunit; | ||
|
||
namespace ImperatorToCK3.UnitTests.CommonUtils.Genes; | ||
|
||
public class AccessoryGeneTests { | ||
[Fact] | ||
public void IndexCanBeSet() { | ||
var reader = new BufferedReader( | ||
"= { index=69 }" | ||
); | ||
var gene = new AccessoryGene("test_gene", reader); | ||
|
||
Assert.Equal((uint)69, gene.Index); | ||
} | ||
|
||
[Fact] | ||
public void IndexDefaultsToNull() { // special_genes accessory genes don't have an index | ||
var reader = new BufferedReader("={}"); | ||
var gene = new AccessoryGene("test_gene", reader); | ||
|
||
Assert.Null(gene.Index); | ||
} | ||
|
||
[Fact] | ||
public void GeneTemplatesDefaultToEmpty() { | ||
var reader = new BufferedReader("={}"); | ||
var gene = new AccessoryGene("test_gene", reader); | ||
|
||
Assert.Empty(gene.GeneTemplates); | ||
} | ||
|
||
[Fact] | ||
public void AccessoryGeneIsProperlyLoaded() { | ||
var reader = new BufferedReader( | ||
" = {\n" + | ||
" index = 95\n" + | ||
" inheritable = no\n" + | ||
" nerdy_hairstyles = {\n" + | ||
" index = 0\n" + | ||
" male = {\n" + | ||
" 6 = male_hair_roman_5\n" + | ||
" 1 = empty\n" + | ||
" }\n" + | ||
" female = {\n" + | ||
" 1 = female_hair_roman_1\n" + | ||
" 1 = female_hair_roman_5\n" + | ||
" }\n" + | ||
" boy = male\n" + | ||
" girl = {\n" + | ||
" 1 = female_hair_roman_1\n" + | ||
" 1 = female_hair_roman_5\n" + | ||
" }\n" + | ||
" }\n" + | ||
" punk_hairstyles = {\n" + | ||
" index = 1\n" + | ||
" male = {\n" + | ||
" 6 = male_hair_roman_1\n" + | ||
" 1 = empty\n" + | ||
" }\n" + | ||
" female = {\n" + | ||
" 1 = female_hair_roman_1\n" + | ||
" 1 = female_hair_roman_2\n" + | ||
" }\n" + | ||
" girl = female\n" + | ||
" } \n" + | ||
"}\n" | ||
); | ||
var gene = new AccessoryGene("test_gene", reader); | ||
|
||
Assert.Equal((uint)95, gene.Index); | ||
Assert.False(gene.Inheritable); | ||
Assert.Equal(2, gene.GeneTemplates.Count); | ||
Assert.Equal((uint)1, gene.GeneTemplates["punk_hairstyles"].Index); | ||
Assert.Equal(4, gene.GeneTemplates["nerdy_hairstyles"].AgeSexWeightBlocks.Count); | ||
Assert.Equal(3, gene.GeneTemplates["punk_hairstyles"].AgeSexWeightBlocks.Count); | ||
} | ||
} |
Oops, something went wrong.