internal static void CheckRectangle(Brush brush, Pen pen, Rect rectangle,
                                                int width, int height,
                                                [CallerMemberName] string methodName = "unknown")
            {
                Application.EnableMSAA = false;

                MeshBuffer meshBuffer            = new MeshBuffer();
                MeshList   meshList              = new MeshList();
                BuiltinGeometryRenderer renderer = new BuiltinGeometryRenderer();

                byte[] bytes;

                using (var context = new RenderContextForTest(width, height))
                {
                    renderer.OnBeforeRead();
                    renderer.DrawRectangle(brush, pen, rectangle);//This must be called after the RenderContextForTest is created, for uploading textures to GPU via OpenGL.
                    renderer.OnAfterRead(meshList);

                    //rebuild mesh buffer
                    meshBuffer.Clear();
                    meshBuffer.Init();
                    meshBuffer.Append(meshList);

                    //draw mesh buffer to screen
                    context.Clear();
                    context.DrawMeshes(meshBuffer);

                    bytes = context.GetRenderedRawBytes();
                }

                Util.CheckExpectedImage(bytes, width, height, $"{RootDir}{nameof(DrawRectangle)}\\{methodName}.png");
            }