Skip to content

Commit

Permalink
Merge pull request #420 from ME3Tweaks/Beta
Browse files Browse the repository at this point in the history
Merge 6.4 Beta to 6.4 Master (Stable)
  • Loading branch information
Mgamerz authored Jul 22, 2024
2 parents e1f6b7e + a06b5ca commit e3d501e
Show file tree
Hide file tree
Showing 803 changed files with 36,454 additions and 16,120 deletions.
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "LegendaryExplorer/submodules/WwiseTools"]
path = LegendaryExplorer/submodules/WwiseTools
url = https://github.com/ME3Tweaks/WwiseTools.git
url = https://github.com/ME3Tweaks/WwiseTools.git
[submodule "LegendaryExplorer/submodules/WwiseParser"]
path = LegendaryExplorer/submodules/WwiseParser
url = https://github.com/ME3Tweaks/WwiseParser.git
1 change: 0 additions & 1 deletion .tokeignore

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This document outlines the basic details about how you can contribute to the toolset.

### Contributing code
If you'd like to contribute code, feel free to come to my Discord server and we can always have a good chat about what you want to. Of course, you don't have to, but it will make both our lives easier. You can just fork and submit pull requests to this repository. Be aware this project is licensed as GPLv3 - any code you submit for pulls will be licensed under this. If your code is not compatible with GPLv3, it won't be accepted.
If you'd like to contribute code, feel free to come to [the ME3Tweaks Discord server](https://discord.gg/s8HA6dc) and we can always have a good chat about what you want to. Of course, you don't have to, but it will make both our lives easier. You can just fork and submit pull requests to this repository. Be aware this project is licensed as GPLv3 - any code you submit for pulls will be licensed under this. If your code is not compatible with GPLv3, it won't be accepted.

- __Fork the Beta branch__ — New code is pushed into the Beta branch before eventually being merged with the master (stable). Additional branches on this repository are sometimes made and are eventually folded (or abandoned) into the Beta branch. Nothing ever will directly commit to stable.
- __Examine the existing Issues__ — This is a great way to become familiar with current tasks and features on the roadmap.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<LangVersion>10.0</LangVersion>
<TargetFramework>net8.0-windows</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>

<Platforms>x64</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.4.0" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="5.1.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="TestData\*" />
</ItemGroup>

<ItemGroup>
<None Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
Expand Down
38 changes: 38 additions & 0 deletions LegendaryExplorer/LegendaryExplorer.Tests/TestData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LegendaryExplorer.Tests;

public static class TestData
{
public static Stream GetTestDataStream(params string[] args)
{
var file = GetTestDataFilePath(args);
if (!File.Exists(file))
{
throw new FileNotFoundException();
}

return File.OpenRead(file);
}

public static byte[] GetTestDataBytes(params string[] args)
{
var file = GetTestDataFilePath(args);
if (!File.Exists(file))
{
throw new FileNotFoundException();
}

return File.ReadAllBytes(file);
}

public static string GetTestDataFilePath(params string[] args)
{
var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string[] pathPart = { assemblyDir, "TestData" };
return Path.Combine(pathPart.Concat(args).ToArray());
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Linq;
using LegendaryExplorer.Tools.AssetDatabase.Filters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NSubstitute;

namespace LegendaryExplorer.Tests.Tools.AssetDatabase
{
Expand All @@ -11,30 +11,30 @@ public class AssetFilterTests
[TestMethod]
public void TestGenericAssetFilter()
{
var match = new Mock<IAssetSpecification<int>>();
match.Setup(x => x.MatchesSpecification(1)).Returns(true);
match.Setup(x => x.IsSelected).Returns(true);
match.Setup(x => x.ShowInUI).Returns(true);
var match = Substitute.For<IAssetSpecification<int>>();
match.MatchesSpecification(1).Returns(true);
match.IsSelected.Returns(true);
match.ShowInUI.Returns(true);

var noMatch = new Mock<IAssetSpecification<int>>();
noMatch.Setup(x => x.MatchesSpecification(1)).Returns(false);
noMatch.SetupSequence(x => x.IsSelected).Returns(false).Returns(true);
noMatch.Setup(x => x.ShowInUI).Returns(true);
var noMatch = Substitute.For<IAssetSpecification<int>>();
noMatch.MatchesSpecification(1).Returns(false);
noMatch.IsSelected.ReturnsForAnyArgs(false, true);
noMatch.ShowInUI.Returns(true);

var notInUI = new Mock<IAssetSpecification<int>>();
notInUI.Setup(x => x.MatchesSpecification(1)).Returns(true);
notInUI.SetupSequence(x => x.IsSelected).Returns(false);
notInUI.Setup(x => x.ShowInUI).Returns(false);
var notInUI = Substitute.For<IAssetSpecification<int>>();
notInUI.MatchesSpecification(1).Returns(true);
notInUI.IsSelected.ReturnsForAnyArgs(false);
notInUI.ShowInUI.Returns(false);

var f = new GenericAssetFilter<int>(new []{match.Object, noMatch.Object, notInUI.Object});
var f = new GenericAssetFilter<int>([match, noMatch, notInUI]);

Assert.IsTrue(f.Filter(1));
match.Verify(x => x.MatchesSpecification(1), Times.Once); // Selected
noMatch.Verify(x => x.MatchesSpecification(1), Times.Never); // Is not selected
notInUI.Verify(x => x.MatchesSpecification(1), Times.Once); // Hidden in UI - Always on
match.Received(1).MatchesSpecification(1); // Selected
noMatch.DidNotReceive().MatchesSpecification(1); // Is not selected
notInUI.Received(1).MatchesSpecification(1); // Hidden in UI - Always on

Assert.IsFalse(f.Filter(1)); // noMatch is now selected
noMatch.Verify(x => x.MatchesSpecification(1), Times.Once);
noMatch.Received(1).MatchesSpecification(1);

Assert.IsFalse(f.Filter("Obj not of type T"));
}
Expand All @@ -59,6 +59,5 @@ public void TestSingleOptionFilter()
f.SetSelected(spec3);
Assert.AreEqual(0, f.Filters.Count(s => s.IsSelected));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public void TestActionSpecification()

spec.IsSelected = true;
Assert.AreEqual(2, timesInvoked);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ public void TestMeshSearch()
Assert.IsFalse(AssetFilters.MeshSearch(("bones:5000", r1)));
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,5 @@ public void TestMaterialSettingSpecInverted()
Assert.IsFalse(spec2.MatchesSpecification(noMatch));
Assert.IsTrue(spec2.MatchesSpecification(noProp));
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.IO;
using Gammtek.Conduit.MassEffect3.SFXGame.CodexMap;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Encoding = System.Text.Encoding;

namespace LegendaryExplorer.Tests.Tools.PlotEditor;

[TestClass]
public class BinaryBioCodexMapTests
{
[TestMethod]
[DataRow("ME3DataCodexMap.bin")]
[DataRow("LE1DataCodexMap.bin")]
[DataRow("LE2DataCodexMap.bin")]
[DataRow("LE2DataCodexMap2.bin")]
[DataRow("LE3DataCodexMap.bin")]
public void BioCodexMap_Reserializes(string filename)
{
var fileStream = TestData.GetTestDataStream("PlotEditor", filename);
var codexMap = BinaryBioCodexMap.Load(fileStream, Encoding.UTF8);

var outputData = new MemoryStream();
var binaryCodexMap = new BinaryBioCodexMap(codexMap.Sections, codexMap.Pages);
binaryCodexMap.Save(outputData);

var bin = TestData.GetTestDataBytes("PlotEditor", filename);
CollectionAssert.AreEquivalent(bin, outputData.ToArray());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.IO;
using Gammtek.Conduit.MassEffect3.SFXGame.QuestMap;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Encoding = System.Text.Encoding;

namespace LegendaryExplorer.Tests.Tools.PlotEditor;

[TestClass]
public class BinaryBioQuestMapTests
{
[TestMethod]
[DataRow("ME3QuestMap.bin")]
[DataRow("LE1QuestMap.bin")]
[DataRow("LE1QuestMap2.bin")]
[DataRow("LE2QuestMap.bin")]
[DataRow("LE3QuestMap.bin")]
public void BioQuestMap_Reserializes(string filename)
{
var fileStream = TestData.GetTestDataStream("PlotEditor", filename);
var questMap = BinaryBioQuestMap.Load(fileStream);

var outputData = new MemoryStream();
var binaryQuestMap = new BinaryBioQuestMap(questMap.Quests, questMap.BoolTaskEvals, questMap.IntTaskEvals, questMap.FloatTaskEvals);
binaryQuestMap.Save(outputData);

var bin = TestData.GetTestDataBytes("PlotEditor", filename);
CollectionAssert.AreEquivalent(bin, outputData.ToArray());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.IO;
using Gammtek.Conduit.MassEffect3.SFXGame.QuestMap;
using Gammtek.Conduit.MassEffect3.SFXGame.StateEventMap;
using LegendaryExplorerCore.Packages;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LegendaryExplorer.Tests.Tools.PlotEditor;

[TestClass]
public class BinaryBioStateEventMapTests
{
[TestMethod]
[DataRow("LE1ConsequenceMap.bin", MEGame.LE1)]
[DataRow("LE1StateTransitionMap.bin", MEGame.LE1)]
[DataRow("LE1StateTransitionMap2.bin", MEGame.LE1)]
[DataRow("LE2StateTransitionMap.bin", MEGame.LE2)]
[DataRow("LE2ConsequenceMap.bin", MEGame.LE2)]
[DataRow("LE3StateTransitionMap.bin", MEGame.LE3)]
public void BioStateEventMap_Reserializes(string filename, MEGame game)
{
var fileStream = TestData.GetTestDataStream("PlotEditor", filename);
var stateEventMap = BinaryBioStateEventMap.Load(fileStream, game);

var outputData = new MemoryStream();
var binaryStateEventMap = new BinaryBioStateEventMap(stateEventMap.StateEvents);
binaryStateEventMap.Save(outputData, game);

var bin = TestData.GetTestDataBytes("PlotEditor", filename);
CollectionAssert.AreEquivalent(bin, outputData.ToArray());
}
}
Loading

0 comments on commit e3d501e

Please sign in to comment.