From 92cd04da3c0eacb4495b093f6eb283c06796a07f Mon Sep 17 00:00:00 2001 From: nieznanysprawiciel Date: Wed, 20 Nov 2024 22:03:35 +0100 Subject: [PATCH] Test brush shaders combinations --- .../TestBrushShaderCompilation.cpp | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/swGUI/Tests/TestRenderingSystem.DX11/TestBrushShaderCompilation.cpp b/swGUI/Tests/TestRenderingSystem.DX11/TestBrushShaderCompilation.cpp index 0c33a351..e85ae28f 100644 --- a/swGUI/Tests/TestRenderingSystem.DX11/TestBrushShaderCompilation.cpp +++ b/swGUI/Tests/TestRenderingSystem.DX11/TestBrushShaderCompilation.cpp @@ -37,6 +37,24 @@ TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.SolidColorBrush", "[GUISy CHECK( renderingData.PixelShader != nullptr ); } +// ================================ // +// +TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.SolidColorBrush.Opacity", "[GUISystem][RenderingSystem][Drawing]" ) +{ + TestFramework* framework = GetGlobalTestFramework(); + + FakeDrawingPtr drawing = std::make_shared< FakeDrawing >(); + SolidColorBrushPtr brush = std::make_shared< SolidColorBrush >(); + ShaderProvider* sp = framework->GetRenderingSystem()->GetShaderProvider(); + + drawing->UpdateBrushShader( sp, brush.get(), sp->GetBasicPSTemplate() ); + + auto& renderingData = CLASS_TESTER( Drawing )::GetBrushRenderingData( drawing.get() ); + + INFO( "[SolidColorBrush] Brush Shader compilation failed." ); + CHECK( renderingData.PixelShader != nullptr ); +} + // ================================ // // TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.LinearGradientBrush", "[GUISystem][RenderingSystem][Drawing]" ) @@ -54,6 +72,24 @@ TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.LinearGradientBrush", "[G CHECK( renderingData.PixelShader != nullptr ); } +// ================================ // +// +TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.LinearGradientBrush.Opacity", "[GUISystem][RenderingSystem][Drawing]" ) +{ + TestFramework* framework = GetGlobalTestFramework(); + + FakeDrawingPtr drawing = std::make_shared< FakeDrawing >(); + LinearGradientBrushPtr brush = std::make_shared< LinearGradientBrush >(); + ShaderProvider* sp = framework->GetRenderingSystem()->GetShaderProvider(); + + drawing->UpdateBrushShader( sp, brush.get(), sp->GetBasicPSTemplate() ); + + auto& renderingData = CLASS_TESTER( Drawing )::GetBrushRenderingData( drawing.get() ); + + INFO( "[LinearGradientBrush] Brush Shader compilation failed." ); + CHECK( renderingData.PixelShader != nullptr ); +} + // ================================ // // TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.AngleGradientBrush", "[GUISystem][RenderingSystem][Drawing]" ) @@ -71,6 +107,24 @@ TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.AngleGradientBrush", "[GU CHECK( renderingData.PixelShader != nullptr ); } +// ================================ // +// +TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.AngleGradientBrush.Opacity", "[GUISystem][RenderingSystem][Drawing]" ) +{ + TestFramework* framework = GetGlobalTestFramework(); + + FakeDrawingPtr drawing = std::make_shared< FakeDrawing >(); + AngleGradientBrushPtr brush = std::make_shared< AngleGradientBrush >(); + ShaderProvider* sp = framework->GetRenderingSystem()->GetShaderProvider(); + + drawing->UpdateBrushShader( sp, brush.get(), sp->GetBasicPSTemplate() ); + + auto& renderingData = CLASS_TESTER( Drawing )::GetBrushRenderingData( drawing.get() ); + + INFO( "[AngleGradientBrush] Brush Shader compilation failed." ); + CHECK( renderingData.PixelShader != nullptr ); +} + // ================================ // // TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.ImageBrush", "[GUISystem][RenderingSystem][Drawing]" ) @@ -88,3 +142,20 @@ TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.ImageBrush", "[GUISystem] CHECK( renderingData.PixelShader != nullptr ); } +// ================================ // +// +TEST_CASE( "GUI.Rendering.DX11.Brush.ShaderCompilation.ImageBrush.Opacity", "[GUISystem][RenderingSystem][Drawing]" ) +{ + TestFramework* framework = GetGlobalTestFramework(); + + FakeDrawingPtr drawing = std::make_shared< FakeDrawing >(); + ImageBrushPtr brush = std::make_shared< ImageBrush >(); + ShaderProvider* sp = framework->GetRenderingSystem()->GetShaderProvider(); + + drawing->UpdateBrushShader( sp, brush.get(), sp->GetBasicPSTemplate() ); + + auto& renderingData = CLASS_TESTER( Drawing )::GetBrushRenderingData( drawing.get() ); + + INFO( "[ImageBrush] Brush Shader compilation failed." ); + CHECK( renderingData.PixelShader != nullptr ); +}