mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-13 08:48:39 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
57 lines
1.4 KiB
C#
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 );
|
|
} );
|
|
}
|
|
}
|