Browse Source

added more comments

stepan_govorko 2 years ago
parent
commit
f5c93a50ab

+ 13 - 5
tests/Avalonia.Base.UnitTests/Rendering/CompositorInvalidationClippingTests.cs

@@ -3,22 +3,27 @@ using Avalonia.Media;
 using Xunit;
 
 namespace Avalonia.Base.UnitTests.Rendering;
-
+/// <summary>
+/// Test class that verifies how clipping influences rendering in the compositor
+/// </summary>
 public class CompositorInvalidationClippingTests : CompositorTestsBase
 {
     [Fact]
+    // Test case: When the ClipToBounds is false, all visuals should be rendered
     public void Siblings_Should_Be_Rendered_On_Invalidate_Without_ClipToBounds()
     {
         AssertRenderedVisuals(clipToBounds: false, clipGeometry: false, expectedRenderedVisualsCount: 4);
     }
 
     [Fact]
+    // Test case: When the ClipToBounds is true, only visuals within the clipped boundary should be rendered
     public void Siblings_Should_Not_Be_Rendered_On_Invalidate_With_ClipToBounds()
     {
         AssertRenderedVisuals(clipToBounds: true, clipGeometry: false, expectedRenderedVisualsCount: 3);
     }
 
     [Fact]
+    // Test case: When the Clip is used, only visuals within the clip geometry should be rendered
     public void Siblings_Should_Not_Be_Rendered_On_Invalidate_With_Clip()
     {
         AssertRenderedVisuals(clipToBounds: false, clipGeometry: true, expectedRenderedVisualsCount: 3);
@@ -28,10 +33,10 @@ public class CompositorInvalidationClippingTests : CompositorTestsBase
     {
         using (var s = new CompositorCanvas())
         {
-            //#1 visual to render is root
-            //#2 visual to render is s.Canvas
+            //#1 visual is top level
+            //#2 visual is s.Canvas
             
-            //#3 visual to render
+            //#3 visual is border1
             s.Canvas.Children.Add(new Border()
             {
                 [Canvas.LeftProperty] = 0, [Canvas.TopProperty] = 0,
@@ -41,7 +46,7 @@ public class CompositorInvalidationClippingTests : CompositorTestsBase
                 Clip = clipGeometry ? new RectangleGeometry(new Rect(new Size(20, 10))) : null
             });
             
-            //#4 visual to render
+            //#4 visual is border2
             s.Canvas.Children.Add(new Border()
             {
                 [Canvas.LeftProperty] = 30, [Canvas.TopProperty] = 50,
@@ -52,8 +57,11 @@ public class CompositorInvalidationClippingTests : CompositorTestsBase
             });
             s.RunJobs();
             s.Events.Reset();
+            
+            //invalidate border1
             s.Canvas.Children[0].IsVisible = false;
             s.RunJobs();
+            
             s.AssertRenderedVisuals(expectedRenderedVisualsCount);
         }
     }