-
Notifications
You must be signed in to change notification settings - Fork 743
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(revealbrush): Use RevealBrush FallbackColor
When a RevealBrush is set, use its FallbackColor for Panel.Background and Border.Background, since the actual reveal effect is not implemented. This fixes TreeView selection background not being displayed (because, surprise, it's using RevealBrush).
- Loading branch information
1 parent
e9ff8cc
commit 035c614
Showing
12 changed files
with
263 additions
and
1 deletion.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Media/RevealBrushTests/RevealBrush_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using SamplesApp.UITests.TestFramework; | ||
|
||
namespace SamplesApp.UITests.Windows_UI_Xaml_Media.RevealBrushTests | ||
{ | ||
[TestFixture] | ||
class RevealBrush_Tests : SampleControlUITestBase | ||
{ | ||
[Test] | ||
[AutoRetry] | ||
public void When_FallbackColor_Set() | ||
{ | ||
Run("UITests.Windows_UI_Xaml_Media.BrushesTests.RevealBrush_Fallback"); | ||
|
||
_app.WaitForElement("StatusTextBlock"); | ||
|
||
var views = new[] | ||
{ | ||
"RevealGrid", | ||
"RevealGridCR", | ||
"RevealBorder", | ||
"RevealBorderCR", | ||
}; | ||
|
||
using var initial = TakeScreenshot("Initial"); | ||
foreach (var view in views) | ||
{ | ||
AssertHasColor(view, initial, Color.Orange); | ||
} | ||
|
||
_app.FastTap("ChangeColorButton"); | ||
_app.WaitForText("StatusTextBlock", "Color changed"); | ||
|
||
using var after = TakeScreenshot("After"); | ||
foreach (var view in views) | ||
{ | ||
AssertHasColor(view, after, Color.ForestGreen); | ||
} | ||
|
||
void AssertHasColor(string view, ScreenshotInfo screenshot, Color expectedColor) | ||
{ | ||
var rect = _app.GetPhysicalRect(view); | ||
ImageAssert.HasColorAt(screenshot, rect.CenterX, rect.CenterY, expectedColor); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Media/BrushesTests/RevealBrush_Fallback.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<UserControl x:Class="UITests.Windows_UI_Xaml_Media.BrushesTests.RevealBrush_Fallback" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Windows_UI_Xaml_Media.BrushesTests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
<UserControl.Resources> | ||
<RevealBackgroundBrush x:Name="OrangeCrush" | ||
Color="Orange" | ||
FallbackColor="Orange" /> | ||
</UserControl.Resources> | ||
|
||
<StackPanel> | ||
<Button x:Name="ChangeColorButton" | ||
Content="Change color" | ||
Click="ChangeColor" /> | ||
<TextBlock x:Name="StatusTextBlock" | ||
Text="Initial" /> | ||
|
||
<Grid Background="{StaticResource OrangeCrush}" | ||
x:Name="RevealGrid" | ||
Margin="10" | ||
Width="120" | ||
Height="55"> | ||
</Grid> | ||
<Grid CornerRadius="10" | ||
Background="{StaticResource OrangeCrush}" | ||
x:Name="RevealGridCR" | ||
Margin="10" | ||
Width="120" | ||
Height="55"> | ||
</Grid> | ||
|
||
<Border Background="{StaticResource OrangeCrush}" | ||
x:Name="RevealBorder" | ||
Margin="10" | ||
Width="120" | ||
Height="55"> | ||
</Border> | ||
<Border CornerRadius="10" | ||
Background="{StaticResource OrangeCrush}" | ||
x:Name="RevealBorderCR" | ||
Margin="10" | ||
Width="120" | ||
Height="55"> | ||
</Border> | ||
|
||
</StackPanel> | ||
</UserControl> |
37 changes: 37 additions & 0 deletions
37
...SamplesApp/UITests.Shared/Windows_UI_Xaml_Media/BrushesTests/RevealBrush_Fallback.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Uno.UI.Samples.Controls; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace UITests.Windows_UI_Xaml_Media.BrushesTests | ||
{ | ||
[Sample] | ||
public sealed partial class RevealBrush_Fallback : UserControl | ||
{ | ||
public RevealBrush_Fallback() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
private void ChangeColor(object sender, object args) | ||
{ | ||
OrangeCrush.Color = Colors.ForestGreen; | ||
OrangeCrush.FallbackColor = Colors.ForestGreen; | ||
StatusTextBlock.Text = "Color changed"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters