|
1 |
| -#if __IOS__ || __MACOS__ |
| 1 | +using System; |
| 2 | + |
2 | 3 | using Foundation;
|
3 | 4 | using Metal;
|
4 | 5 |
|
@@ -50,6 +51,52 @@ public void SampleCount ()
|
50 | 51 | => Assert.DoesNotThrow (() => {
|
51 | 52 | var c = descriptor.SampleCount;
|
52 | 53 | });
|
| 54 | + |
| 55 | + [Test] |
| 56 | + public void Create_1 () |
| 57 | + { |
| 58 | + var horizontal = new float [] { 1, 2, 3 }; |
| 59 | + var vertical = new float [] { 5, 6, 7, 8 }; |
| 60 | + using var obj = MTLRasterizationRateLayerDescriptor.Create (new MTLSize (horizontal.Length, vertical.Length, 42), horizontal, vertical); |
| 61 | + Assert.AreEqual ((nint) horizontal.Length, obj.SampleCount.Width, "Width"); |
| 62 | + Assert.AreEqual ((nint) vertical.Length, obj.SampleCount.Height, "Height"); |
| 63 | + Assert.AreEqual ((nint) 0, obj.SampleCount.Depth, "Depth"); |
| 64 | + Assert.That (obj.HorizontalSampleStorage, Is.EqualTo (horizontal), "HorizontalSampleStorage"); |
| 65 | + Assert.That (obj.VerticalSampleStorage, Is.EqualTo (vertical), "VerticalSampleStorage"); |
| 66 | + |
| 67 | + Assert.Throws<ArgumentNullException> (() => MTLRasterizationRateLayerDescriptor.Create (new MTLSize (horizontal.Length, vertical.Length, 0), null, vertical), "H-Null"); |
| 68 | + Assert.Throws<ArgumentNullException> (() => MTLRasterizationRateLayerDescriptor.Create (new MTLSize (horizontal.Length, vertical.Length, 0), horizontal, null), "V-Null"); |
| 69 | + Assert.Throws<ArgumentOutOfRangeException> (() => MTLRasterizationRateLayerDescriptor.Create (new MTLSize (horizontal.Length + 1, vertical.Length, 0), horizontal, vertical), "H-AOORE"); |
| 70 | + Assert.Throws<ArgumentOutOfRangeException> (() => MTLRasterizationRateLayerDescriptor.Create (new MTLSize (horizontal.Length, vertical.Length - 1, 0), horizontal, vertical), "V-AOORE"); |
| 71 | + } |
| 72 | + |
| 73 | + [Test] |
| 74 | + public void Create_2 () |
| 75 | + { |
| 76 | + var horizontal = new float [] { 1, 2, 3 }; |
| 77 | + var vertical = new float [] { 5, 6, 7, 8 }; |
| 78 | + using var obj = MTLRasterizationRateLayerDescriptor.Create (horizontal, vertical); |
| 79 | + Assert.AreEqual ((nint) horizontal.Length, obj.SampleCount.Width, "Width"); |
| 80 | + Assert.AreEqual ((nint) vertical.Length, obj.SampleCount.Height, "Height"); |
| 81 | + Assert.AreEqual ((nint) 0, obj.SampleCount.Depth, "Depth"); |
| 82 | + Assert.That (obj.HorizontalSampleStorage, Is.EqualTo (horizontal), "HorizontalSampleStorage"); |
| 83 | + Assert.That (obj.VerticalSampleStorage, Is.EqualTo (vertical), "VerticalSampleStorage"); |
| 84 | + |
| 85 | + Assert.Throws<ArgumentNullException> (() => MTLRasterizationRateLayerDescriptor.Create (null, vertical), "H-Null"); |
| 86 | + Assert.Throws<ArgumentNullException> (() => MTLRasterizationRateLayerDescriptor.Create (horizontal, null), "V-Null"); |
| 87 | + } |
| 88 | + |
| 89 | + [Test] |
| 90 | + public void Ctor () |
| 91 | + { |
| 92 | + var horizontal = new float [3]; |
| 93 | + var vertical = new float [4]; |
| 94 | + using var obj = new MTLRasterizationRateLayerDescriptor (new MTLSize (horizontal.Length, vertical.Length, 0)); |
| 95 | + Assert.AreEqual ((nint) horizontal.Length, obj.SampleCount.Width, "Width"); |
| 96 | + Assert.AreEqual ((nint) vertical.Length, obj.SampleCount.Height, "Height"); |
| 97 | + Assert.AreEqual ((nint) 0, obj.SampleCount.Depth, "Depth"); |
| 98 | + Assert.That (obj.HorizontalSampleStorage, Is.EqualTo (horizontal), "HorizontalSampleStorage"); |
| 99 | + Assert.That (obj.VerticalSampleStorage, Is.EqualTo (vertical), "VerticalSampleStorage"); |
| 100 | + } |
53 | 101 | }
|
54 | 102 | }
|
55 |
| -#endif |
|
0 commit comments