|
|
|
@ -11,8 +11,14 @@ namespace ImageSharp.Tests |
|
|
|
{ |
|
|
|
public const string ImageSharpSolution = "ImageSharp.sln"; |
|
|
|
|
|
|
|
public const string InputImagesRelativePath = @"tests\ImageSharp.Tests\TestImages\Formats"; |
|
|
|
|
|
|
|
private const string InputImagesRelativePath = @"tests\TestImages\Input"; |
|
|
|
|
|
|
|
private const string ActualOutputDirectoryRelativePath = @"tests\TestImages\ActualOutput"; |
|
|
|
|
|
|
|
private const string ReferenceOutputDirectoryRelativePath = @"tests\TestImages\ReferenceOutput"; |
|
|
|
|
|
|
|
private static Lazy<string> solutionDirectoryFullPath = new Lazy<string>(GetSolutionDirectoryFullPathImpl); |
|
|
|
|
|
|
|
private static Lazy<bool> runsOnCi = new Lazy<bool>( |
|
|
|
() => |
|
|
|
{ |
|
|
|
@ -25,8 +31,10 @@ namespace ImageSharp.Tests |
|
|
|
/// Gets a value indicating whether test execution runs on CI.
|
|
|
|
/// </summary>
|
|
|
|
internal static bool RunsOnCI => runsOnCi.Value; |
|
|
|
|
|
|
|
internal static string GetSolutionDirectoryFullPath() |
|
|
|
|
|
|
|
internal static string SolutionDirectoryFullPath => solutionDirectoryFullPath.Value; |
|
|
|
|
|
|
|
private static string GetSolutionDirectoryFullPathImpl() |
|
|
|
{ |
|
|
|
string assemblyLocation = typeof(TestFile).GetTypeInfo().Assembly.Location; |
|
|
|
|
|
|
|
@ -51,22 +59,26 @@ namespace ImageSharp.Tests |
|
|
|
throw new Exception($"Unable to find ImageSharp solution directory from {assemblyLocation}!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return directory.FullName; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the correct full path to the Input Images directory.
|
|
|
|
/// </summary>
|
|
|
|
internal static string InputImagesDirectoryFullPath => Path.Combine(SolutionDirectoryFullPath, InputImagesRelativePath); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the correct path to the InputImages directory.
|
|
|
|
/// Gets the correct full path to the Actual Output directory. (To be written to by the test cases.)
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>
|
|
|
|
/// The <see cref="string"/>.
|
|
|
|
/// </returns>
|
|
|
|
internal static string GetInputImagesDirectoryFullPath() |
|
|
|
{ |
|
|
|
string soulitionDir = GetSolutionDirectoryFullPath(); |
|
|
|
internal static string ActualOutputDirectoryFullPath => Path.Combine(SolutionDirectoryFullPath, ActualOutputDirectoryRelativePath); |
|
|
|
|
|
|
|
return Path.Combine(soulitionDir, InputImagesRelativePath); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the correct full path to the Expected Output directory. (To compare the test results to.)
|
|
|
|
/// </summary>
|
|
|
|
internal static string ReferenceOutputDirectoryFullPath => Path.Combine(SolutionDirectoryFullPath, ReferenceOutputDirectoryRelativePath); |
|
|
|
|
|
|
|
internal static string GetReferenceOutputFileName(string actualOutputFileName) => |
|
|
|
actualOutputFileName.Replace("ActualOutput", "ExpectedOutput"); |
|
|
|
} |
|
|
|
} |