Files
sbox-public/engine/Tests/Sandbox.Test.Engine/System/ThirdPartyLegalTest.cs
Garry Newman d95169d8fa Unit Test Cleanup (#5064)
* Move all unit tests to Engine/Tests
* Fix Margin.EdgeSubtract
* Fix Capsule.Contains
* EnvironmentVariables.Remove if it's null
* Fixed ray trace never returning startedsolid
* Fix HistoryList.Navigate on empty list
* Fix GameObject.WorldPosition accepting NaNs
* Fix flex: initial expanding to the wrong grow/shrink
* Translation.TryConvert shouldn't throw on invalid enum strings
* Skip sound file tests on machines with no audio device
2026-06-12 13:23:50 +01:00

35 lines
1.3 KiB
C#

using System;
using System.IO;
using static Editor.AboutWidget;
namespace SystemTests;
[TestClass]
public class ThirdPartyLegalTest
{
[TestMethod]
public void CheckJsonValidity()
{
var fileData = File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
var indexData = Json.Deserialize<DependencyIndex>( fileData );
// If we got this far without an exception, the JSON is valid
Assert.IsNotNull( indexData );
Assert.IsTrue( indexData.Components.Any(), "Dependency index deserialized to an empty component list" );
}
[TestMethod]
public void CheckAllLicensesExist()
{
var fileData = File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
var indexData = Json.Deserialize<DependencyIndex>( fileData );
Assert.IsTrue( indexData.Components.Any(), "Dependency index deserialized to an empty component list" );
foreach ( var component in indexData.Components )
{
// We don't require a license for public domain components
if ( component.License.ToLower() == "public-domain" || component.License.ToLower() == "proprietary" ) continue;
var licensePath = Path.Combine( "thirdpartylegalnotices/licenses/", component.Name.ToLower().Replace( " ", "-" ) );
Assert.IsTrue( File.Exists( licensePath ), $"License file missing: {licensePath}" );
}
}
}