Esempio n. 1
0
        public async Task OnGetProperty_CanRetrieveColor()
        {
            await Window.SetXamlContent(@"<Grid x:Name=""MyGrid"" Background=""Red"" />");

            IVisualElement <Grid> element = await Window.GetElement <Grid>("MyGrid");

            Assert.AreEqual(Colors.Red, await element.GetBackgroundColor());
        }
Esempio n. 2
0
        public async Task OnGetProperty_CanRetrieveColor()
        {
            IWindow window = await App.CreateWindowWithContent(
                @"<Grid x:Name=""MyGrid"" Background=""Red"" />");

            IVisualElement element = await window.GetElement("MyGrid");

            Assert.AreEqual(Colors.Red, await element.GetBackgroundColor());
        }
Esempio n. 3
0
        public async Task Mode_SetsThemeColors(ColorZoneMode mode, string backgroundBrush, string foregroundBrush)
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement <ColorZone> colorZone = await LoadXaml <ColorZone>(@$ "
<materialDesign:ColorZone Mode=" "{mode}" "/>
");

            Color background = await GetThemeColor(backgroundBrush);

            Color foreground = await GetThemeColor(foregroundBrush);

            Assert.Equal(background, await colorZone.GetBackgroundColor());
            Assert.Equal(foreground, await colorZone.GetForegroundColor());

            recorder.Success();
        }
Esempio n. 4
0
        public async Task OnLoad_ThemeBrushesSet()
        {
            await using var recorder = new TestRecorder(App);

            //Arrange
            IVisualElement <Button> button = await LoadXaml <Button>(@"<Button Content=""Button"" />");

            Color midColor = await GetThemeColor("PrimaryHueMidBrush");

            //Act
            Color?color = await button.GetBackgroundColor();

            //Assert
            Assert.Equal(midColor, color);

            recorder.Success();
        }