Exemplo n.º 1
0
        public async Task CharacterSpacingInitializesCorrectly()
        {
            var xplatCharacterSpacing = 4;

            var items = new List <string>
            {
                "Item 1",
                "Item 2",
                "Item 3"
            };

            var picker = new PickerStub()
            {
                Title            = "Select an Item",
                CharacterSpacing = xplatCharacterSpacing
            };

            picker.ItemsSource   = items;
            picker.SelectedIndex = 0;

            float expectedValue = picker.CharacterSpacing.ToEm();

            var values = await GetValueAsync(picker, (handler) =>
            {
                return(new
                {
                    ViewValue = picker.CharacterSpacing,
                    NativeViewValue = GetNativeCharacterSpacing(handler)
                });
            });

            Assert.Equal(xplatCharacterSpacing, values.ViewValue);
            Assert.Equal(expectedValue, values.NativeViewValue, EmCoefficientPrecision);
        }
Exemplo n.º 2
0
        public async Task TextColorInitializesCorrectly()
        {
            var xplatTitleColor = Colors.CadetBlue;

            var picker = new PickerStub
            {
                Title         = "Select an Item",
                TextColor     = xplatTitleColor,
                Items         = new[] { "Item 1", "Item2", "Item3" },
                SelectedIndex = 1
            };

            var expectedValue = xplatTitleColor.ToNative();

            var values = await GetValueAsync(picker, (handler) =>
            {
                return(new
                {
                    ViewValue = picker.TextColor,
                    NativeViewValue = GetNativeTextColor(handler)
                });
            });

            Assert.Equal(xplatTitleColor, values.ViewValue);
            Assert.Equal(expectedValue, values.NativeViewValue);
        }
Exemplo n.º 3
0
        public async Task TitleInitializesCorrectly()
        {
            var picker = new PickerStub
            {
                Title = "Select an Item"
            };

            await ValidatePropertyInitValue(picker, () => picker.Title, GetNativeTitle, picker.Title);
        }
Exemplo n.º 4
0
        public async Task TitleColorInitializesCorrectly()
        {
            var picker = new PickerStub
            {
                Title      = "Select an Item",
                TitleColor = Colors.CadetBlue
            };

            await ValidatePropertyInitValue(picker, () => picker.TitleColor, GetNativeTitleColor, picker.TitleColor);
        }
Exemplo n.º 5
0
        public async Task TextColorInitializesCorrectly()
        {
            var picker = new PickerStub
            {
                Title         = "Select an Item",
                TextColor     = Colors.CadetBlue,
                Items         = new[] { "Item 1", "Item2", "Item3" },
                SelectedIndex = 1
            };

            await ValidatePropertyInitValue(picker, () => picker.TextColor, GetNativeTextColor, picker.TextColor);
        }
Exemplo n.º 6
0
        public async Task TitleColorInitializesCorrectly()
        {
            var xplatTitleColor = Colors.CadetBlue;

            var picker = new PickerStub
            {
                Title      = "Select an Item",
                TitleColor = xplatTitleColor
            };

            var expectedValue = xplatTitleColor.ToPlatform();

            var values = await GetValueAsync(picker, (handler) =>
            {
                return(new
                {
                    ViewValue = picker.TitleColor,
                    PlatformViewValue = GetNativeTitleColor(handler)
                });
            });

            Assert.Equal(xplatTitleColor, values.ViewValue);
            Assert.Equal(expectedValue, values.PlatformViewValue);
        }