SixelSupportResultTests.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #nullable enable
  2. namespace DrawingTests;
  3. public class SixelSupportResultTests
  4. {
  5. [Fact]
  6. public void Defaults_AreCorrect ()
  7. {
  8. // Arrange & Act
  9. var result = new SixelSupportResult ();
  10. // Assert
  11. Assert.False (result.IsSupported);
  12. Assert.Equal (10, result.Resolution.Width);
  13. Assert.Equal (20, result.Resolution.Height);
  14. Assert.Equal (256, result.MaxPaletteColors);
  15. Assert.False (result.SupportsTransparency);
  16. }
  17. [Fact]
  18. public void Properties_CanBeModified ()
  19. {
  20. // Arrange
  21. var result = new SixelSupportResult ();
  22. // Act
  23. result.IsSupported = true;
  24. result.Resolution = new Size (24, 48);
  25. result.MaxPaletteColors = 16;
  26. result.SupportsTransparency = true;
  27. // Assert
  28. Assert.True (result.IsSupported);
  29. Assert.Equal (24, result.Resolution.Width);
  30. Assert.Equal (48, result.Resolution.Height);
  31. Assert.Equal (16, result.MaxPaletteColors);
  32. Assert.True (result.SupportsTransparency);
  33. }
  34. [Fact]
  35. public void Resolution_IsValueType_CopyDoesNotAffectOriginal ()
  36. {
  37. // Arrange
  38. var result = new SixelSupportResult ();
  39. Size original = result.Resolution;
  40. // Act
  41. // Mutate a local copy and ensure original remains unchanged
  42. Size copy = original;
  43. copy.Width = 123;
  44. copy.Height = 456;
  45. // Assert
  46. Assert.Equal (10, result.Resolution.Width);
  47. Assert.Equal (20, result.Resolution.Height);
  48. Assert.Equal (10, original.Width);
  49. Assert.Equal (20, original.Height);
  50. Assert.Equal (123, copy.Width);
  51. Assert.Equal (456, copy.Height);
  52. }
  53. }