Files
sbox-public/engine/Sandbox.Test/Texture/TextureTest.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

57 lines
1.4 KiB
C#

using System;
namespace TestTexture;
[TestClass]
public class TextureTest
{
[TestMethod]
public void Copy()
{
var src = Texture.Create( 1, 1 ).Finish();
var dst = Texture.Create( 1, 1 ).Finish();
try
{
Graphics.CopyTexture( src, dst );
}
catch ( Exception ex )
{
Assert.Fail( $"Valid CopyTexture call threw an exception: {ex}" );
}
try
{
Graphics.CopyTexture( src, dst, srcMipSlice: 0, srcArraySlice: 0, dstMipSlice: 0, dstArraySlice: 0 );
}
catch ( Exception ex )
{
Assert.Fail( $"Valid CopyTexture call threw an exception: {ex}" );
}
// Out-of-range mip on src
Assert.ThrowsException<ArgumentException>( () =>
{
Graphics.CopyTexture( src, dst, srcMipSlice: 1, srcArraySlice: 0, dstMipSlice: 0, dstArraySlice: 0 );
} );
// Out-of-range array slice on src
Assert.ThrowsException<ArgumentException>( () =>
{
Graphics.CopyTexture( src, dst, srcMipSlice: 0, srcArraySlice: 1, dstMipSlice: 0, dstArraySlice: 0 );
} );
// Out-of-range mip on dst
Assert.ThrowsException<ArgumentException>( () =>
{
Graphics.CopyTexture( src, dst, srcMipSlice: 0, srcArraySlice: 0, dstMipSlice: 1, dstArraySlice: 0 );
} );
// Out-of-range array slice on dst
Assert.ThrowsException<ArgumentException>( () =>
{
Graphics.CopyTexture( src, dst, srcMipSlice: 0, srcArraySlice: 0, dstMipSlice: 0, dstArraySlice: 1 );
} );
}
}