mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-07-31 07:48:52 -04:00
* 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
38 lines
816 B
C#
38 lines
816 B
C#
using Sandbox.UI;
|
|
namespace UITests.Panels;
|
|
|
|
[TestClass]
|
|
[DoNotParallelize] // Modfiies UI System Global
|
|
public partial class PanelTest
|
|
{
|
|
[TestMethod]
|
|
public void SetClass()
|
|
{
|
|
var panel = new Panel();
|
|
panel.SetClass( "one", true );
|
|
|
|
Assert.IsTrue( panel.HasClass( "one" ) );
|
|
Assert.IsFalse( panel.HasClass( "two" ) );
|
|
|
|
panel.SetClass( "one", false );
|
|
|
|
Assert.IsFalse( panel.HasClass( "one" ) );
|
|
Assert.IsFalse( panel.HasClass( "two" ) );
|
|
|
|
panel.AddClass( "one" );
|
|
|
|
Assert.IsTrue( panel.HasClass( "one" ) );
|
|
Assert.IsFalse( panel.HasClass( "two" ) );
|
|
|
|
panel.AddClass( "two" );
|
|
|
|
Assert.IsTrue( panel.HasClass( "one" ) );
|
|
Assert.IsTrue( panel.HasClass( "two" ) );
|
|
|
|
panel.RemoveClass( "two" );
|
|
|
|
Assert.IsTrue( panel.HasClass( "one" ) );
|
|
Assert.IsFalse( panel.HasClass( "two" ) );
|
|
}
|
|
}
|