diff --git a/src/Controls/src/Core/Brush/BrushTypeConverter.cs b/src/Controls/src/Core/Brush/BrushTypeConverter.cs index e1bd56a8f48e..9c71ac353c90 100644 --- a/src/Controls/src/Core/Brush/BrushTypeConverter.cs +++ b/src/Controls/src/Core/Brush/BrushTypeConverter.cs @@ -1,4 +1,3 @@ -#nullable disable using System; using System.Collections.Generic; using System.ComponentModel; @@ -27,17 +26,17 @@ public class BrushTypeConverter : TypeConverter /// public const string Hsla = "hsla"; - readonly ColorTypeConverter _colorTypeConverter = new ColorTypeConverter(); + readonly ColorTypeConverter _colorTypeConverter = new(); - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) => sourceType == typeof(string) || sourceType == typeof(Color) || sourceType == typeof(Paint); - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType) => destinationType == typeof(Paint); - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) { if (value is Color colorValue) { @@ -50,7 +49,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c var strValue = value?.ToString(); - if (strValue != null) + if (strValue is not null) { strValue = strValue.Trim(); @@ -59,29 +58,34 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c var gradientBrushParser = new GradientBrushParser(_colorTypeConverter); var brush = gradientBrushParser.Parse(strValue); - if (brush != null) + if (brush is not null) + { return brush; + } } - if (strValue.StartsWith(Rgb, StringComparison.InvariantCulture) || strValue.StartsWith(Rgba, StringComparison.InvariantCulture) || strValue.StartsWith(Hsl, StringComparison.InvariantCulture) || strValue.StartsWith(Hsla)) + if (strValue.StartsWith(Rgb, StringComparison.InvariantCulture) + || strValue.StartsWith(Rgba, StringComparison.InvariantCulture) + || strValue.StartsWith(Hsl, StringComparison.InvariantCulture) + || strValue.StartsWith(Hsla, StringComparison.InvariantCulture)) { - var color = (Color)_colorTypeConverter.ConvertFromInvariantString(strValue); + var color = (Color?)_colorTypeConverter.ConvertFromInvariantString(strValue); return new SolidColorBrush(color); } - } - string[] parts = strValue.Split('.'); + string[] parts = strValue.Split('.'); - if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Color")) - { - var color = (Color)_colorTypeConverter.ConvertFromInvariantString(strValue); - return new SolidColorBrush(color); + if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Color")) + { + var color = (Color?)_colorTypeConverter.ConvertFromInvariantString(strValue); + return new SolidColorBrush(color); + } } return new SolidColorBrush(null); } - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (value is Brush brush && destinationType == typeof(Paint)) { @@ -94,16 +98,16 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul public class GradientBrushParser { readonly ColorTypeConverter _colorConverter; - GradientBrush _gradient; - string[] _parts; + GradientBrush? _gradient; + string[]? _parts; int _position; - public GradientBrushParser(ColorTypeConverter colorConverter = null) + public GradientBrushParser(ColorTypeConverter? colorConverter = null) { - _colorConverter = colorConverter ?? new ColorTypeConverter(); + _colorConverter = colorConverter ?? new(); } - public GradientBrush Parse(string css) + public GradientBrush? Parse(string? css) { if (string.IsNullOrWhiteSpace(css)) { @@ -111,9 +115,9 @@ public GradientBrush Parse(string css) } #if NETSTANDARD2_0 - _parts = css.Replace("\r\n", "") + _parts = css!.Replace("\r\n", "") #else - _parts = css.Replace("\r\n", "", StringComparison.Ordinal) + _parts = css!.Replace("\r\n", "", StringComparison.Ordinal) #endif .Split(new[] { '(', ')', ',' }, StringSplitOptions.RemoveEmptyEntries); @@ -125,7 +129,7 @@ public GradientBrush Parse(string css) if (part.StartsWith("#", StringComparison.Ordinal)) { var parts = part.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var color = (Color)_colorConverter.ConvertFromInvariantString(parts[0]); + var color = (Color)_colorConverter.ConvertFromInvariantString(parts[0])!; if (TryParseOffsets(parts, out var offsets)) AddGradientStops(color, offsets); @@ -138,7 +142,7 @@ public GradientBrush Parse(string css) if (colorParts[0].Equals("Color", StringComparison.Ordinal)) { var parts = part.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var color = (Color)_colorConverter.ConvertFromInvariantString(parts[0]); + var color = (Color)_colorConverter.ConvertFromInvariantString(parts[0])!; if (TryParseOffsets(parts, out var offsets)) AddGradientStops(color, offsets); @@ -169,7 +173,7 @@ public GradientBrush Parse(string css) colorString.Append(')'); - var color = (Color)_colorConverter.ConvertFromInvariantString(colorString.ToString()); + var color = (Color)_colorConverter.ConvertFromInvariantString(colorString.ToString())!; var parts = GetNextPart().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (TryParseOffsets(parts, out var offsets)) @@ -211,7 +215,7 @@ public GradientBrush Parse(string css) string GetPart() { - if (!(_position < _parts.Length)) + if (!(_position < _parts!.Length)) return string.Empty; return _parts[_position]; @@ -259,13 +263,15 @@ void AddGradientStop(Color color, float? offset = null) Offset = offset ?? -1 }; - _gradient.GradientStops.Add(gradientStop); + _gradient!.GradientStops.Add(gradientStop); } void AddGradientStops(Color color, IEnumerable offsets) { foreach (var offset in offsets) + { AddGradientStop(color, offset); + } } Tuple GetCoordinatesByAngle(double angle) @@ -417,7 +423,9 @@ bool TryParseOffsets(string[] parts, out float[] result) foreach (var part in parts) { if (TryParseOffset(part, out var offset)) + { offsets.Add(offset); + } } result = offsets.ToArray(); diff --git a/src/Controls/src/Core/ColumnDefinitionCollectionTypeConverter.cs b/src/Controls/src/Core/ColumnDefinitionCollectionTypeConverter.cs index edcfd9eeb48d..3391fdde213e 100644 --- a/src/Controls/src/Core/ColumnDefinitionCollectionTypeConverter.cs +++ b/src/Controls/src/Core/ColumnDefinitionCollectionTypeConverter.cs @@ -1,4 +1,3 @@ -#nullable disable using System; using System.ComponentModel; using System.Globalization; @@ -11,23 +10,27 @@ namespace Microsoft.Maui.Controls [ProvideCompiled("Microsoft.Maui.Controls.XamlC.ColumnDefinitionCollectionTypeConverter")] public class ColumnDefinitionCollectionTypeConverter : TypeConverter { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) => sourceType == typeof(string); - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType) => destinationType == typeof(string); - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) { var strValue = value?.ToString(); - if (strValue != null) + if (strValue is not null) { var lengths = strValue.Split(','); var converter = new GridLengthTypeConverter(); var definitions = new ColumnDefinition[lengths.Length]; + for (var i = 0; i < lengths.Length; i++) - definitions[i] = new ColumnDefinition { Width = (GridLength)converter.ConvertFromInvariantString(lengths[i]) }; + { + definitions[i] = new ColumnDefinition { Width = (GridLength)converter.ConvertFromInvariantString(lengths[i])! }; + } + return new ColumnDefinitionCollection(definitions); } @@ -35,10 +38,13 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (value is not ColumnDefinitionCollection cdc) + { throw new NotSupportedException(); + } + var converter = new GridLengthTypeConverter(); return string.Join(", ", cdc.Select(cd => converter.ConvertToInvariantString(cd.Width))); } diff --git a/src/Controls/src/Core/DecorableTextElement.cs b/src/Controls/src/Core/DecorableTextElement.cs index 14e079f82098..2f02e14ae97e 100644 --- a/src/Controls/src/Core/DecorableTextElement.cs +++ b/src/Controls/src/Core/DecorableTextElement.cs @@ -1,4 +1,3 @@ -#nullable disable using System; using System.ComponentModel; using System.Globalization; @@ -14,13 +13,13 @@ static class DecorableTextElement /// public class TextDecorationConverter : TypeConverter { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) => sourceType == typeof(string); - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType) => destinationType == typeof(string); - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) { var strValue = value?.ToString(); @@ -46,7 +45,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c return result; } - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (value is not TextDecorations td) throw new NotSupportedException(); diff --git a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt index fc9cabedb524..14eb191c737e 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -316,3 +316,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt index 50284f50df52..d4c3b90b06ef 100644 --- a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -515,3 +515,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index 5b65a0afd7b6..dd76e3f7ccd7 100644 --- a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -515,3 +515,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index 014df1989f1e..5d7c9911fc37 100644 --- a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -307,3 +307,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt index 2bdc0f0207fe..d42197da3be4 100644 --- a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -315,3 +315,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt index ac2973533042..b2e48b185fe9 100644 --- a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt @@ -306,3 +306,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt index 563b30b2d6ad..04ac604659b5 100644 --- a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt @@ -305,3 +305,36 @@ override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesSupport override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext? context) -> bool override Microsoft.Maui.Controls.LayoutOptionsConverter.GetStandardValues(System.ComponentModel.ITypeDescriptorContext? context) -> System.ComponentModel.TypeConverter.StandardValuesCollection! Microsoft.Maui.Controls.IExtendedTypeConverter.ConvertFromInvariantString(string! value, System.IServiceProvider! serviceProvider) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathGeometryConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.Shapes.MatrixTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.TextDecorationConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object? +override Microsoft.Maui.Controls.BrushTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object? +const Microsoft.Maui.Controls.BrushTypeConverter.Hsl = "hsl" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Hsla = "hsla" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.LinearGradient = "linear-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.RadialGradient = "radial-gradient" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgb = "rgb" -> string! +const Microsoft.Maui.Controls.BrushTypeConverter.Rgba = "rgba" -> string! +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.GradientBrushParser(Microsoft.Maui.Graphics.Converters.ColorTypeConverter? colorConverter = null) -> void +Microsoft.Maui.Controls.BrushTypeConverter.GradientBrushParser.Parse(string? css) -> Microsoft.Maui.Controls.GradientBrush? +static Microsoft.Maui.Controls.Shapes.PathFigureCollectionConverter.ParseStringToPathFigureCollection(Microsoft.Maui.Controls.Shapes.PathFigureCollection! pathFigureCollection, string? pathString) -> void \ No newline at end of file diff --git a/src/Controls/src/Core/Shapes/MatrixTypeConverter.cs b/src/Controls/src/Core/Shapes/MatrixTypeConverter.cs index 967ceafe97d6..61f4cc47a14c 100644 --- a/src/Controls/src/Core/Shapes/MatrixTypeConverter.cs +++ b/src/Controls/src/Core/Shapes/MatrixTypeConverter.cs @@ -1,4 +1,3 @@ -#nullable disable using System; using System.ComponentModel; using System.Globalization; @@ -8,38 +7,51 @@ namespace Microsoft.Maui.Controls.Shapes /// public class MatrixTypeConverter : TypeConverter { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + static readonly char[] _separator = [' ', ',']; + + public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) => sourceType == typeof(string); - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType) => destinationType == typeof(string); - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) => CreateMatrix(value?.ToString()); - internal static Matrix CreateMatrix(string value) + internal static Matrix CreateMatrix(string? value) { if (string.IsNullOrEmpty(value)) + { throw new ArgumentException("Argument is null or empty"); + } - string[] strs = value.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); + string[] strs = value!.Split(_separator, StringSplitOptions.RemoveEmptyEntries); if (strs.Length != 6) + { throw new ArgumentException("Argument must have six numbers"); + } double[] values = new double[6]; for (int i = 0; i < 6; i++) + { if (!double.TryParse(strs[i], NumberStyles.Number, CultureInfo.InvariantCulture, out values[i])) + { throw new ArgumentException("Argument must be numeric values"); + } + } return new Matrix(values[0], values[1], values[2], values[3], values[4], values[5]); } - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (value is not Matrix matrix) + { throw new NotSupportedException(); + } + return $"{matrix.M11.ToString(CultureInfo.InvariantCulture)}, {matrix.M12.ToString(CultureInfo.InvariantCulture)}, {matrix.M21.ToString(CultureInfo.InvariantCulture)}, {matrix.M22.ToString(CultureInfo.InvariantCulture)}, {matrix.OffsetX.ToString(CultureInfo.InvariantCulture)}, {matrix.OffsetY.ToString(CultureInfo.InvariantCulture)}"; } } diff --git a/src/Controls/src/Core/Shapes/PathFigureCollectionConverter.cs b/src/Controls/src/Core/Shapes/PathFigureCollectionConverter.cs index f4a81edcf86c..89adba85a133 100644 --- a/src/Controls/src/Core/Shapes/PathFigureCollectionConverter.cs +++ b/src/Controls/src/Core/Shapes/PathFigureCollectionConverter.cs @@ -1,4 +1,3 @@ -#nullable disable using System; using System.ComponentModel; using System.Globalization; @@ -12,16 +11,16 @@ namespace Microsoft.Maui.Controls.Shapes /// public class PathFigureCollectionConverter : TypeConverter { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) => sourceType == typeof(string); - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType) => destinationType == typeof(string); const bool AllowSign = true; const bool AllowComma = true; - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) { var strValue = value?.ToString(); PathFigureCollection pathFigureCollection = new PathFigureCollection(); @@ -32,10 +31,10 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } /// - public static void ParseStringToPathFigureCollection(PathFigureCollection pathFigureCollection, string pathString) + public static void ParseStringToPathFigureCollection(PathFigureCollection pathFigureCollection, string? pathString) { bool figureStarted = default; - string currentPathString = default; + string? currentPathString = null; int pathLength = default; int currentIndex = default; Point lastStart = default; @@ -82,7 +81,7 @@ public static void ParseStringToPathFigureCollection(PathFigureCollection pathFi void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, string pathString, int startIndex) { - PathFigure pathFigure = null; + PathFigure? pathFigure = null; currentPathString = pathString; pathLength = pathString.Length; @@ -106,7 +105,7 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri { if ((cmd != 'M') && (cmd != 'm')) // Path starts with M|m { - ThrowBadToken(); + throw GetBadTokenException(); } first = false; @@ -175,7 +174,7 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri break; } - pathFigure.Segments.Add(new LineSegment + EnsurePathFigure(pathFigure).Segments.Add(new LineSegment { Point = lastPoint }); @@ -224,7 +223,7 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri Point3 = lastPoint }; - pathFigure.Segments.Add(bezierSegment); + EnsurePathFigure(pathFigure).Segments.Add(bezierSegment); last_cmd = 'C'; } @@ -265,7 +264,8 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri Point2 = lastPoint }; - pathFigure.Segments.Add(quadraticBezierSegment); + + EnsurePathFigure(pathFigure).Segments.Add(quadraticBezierSegment); last_cmd = 'Q'; } @@ -297,7 +297,7 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri Point = lastPoint }; - pathFigure.Segments.Add(arcSegment); + EnsurePathFigure(pathFigure).Segments.Add(arcSegment); } while (IsNumber(AllowComma)); @@ -307,7 +307,7 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri case 'z': case 'Z': EnsureFigure(); - pathFigure.IsClosed = true; + EnsurePathFigure(pathFigure).IsClosed = true; figureStarted = false; last_cmd = 'Z'; @@ -315,16 +315,29 @@ void ParseToPathFigureCollection(PathFigureCollection pathFigureCollection, stri break; default: - ThrowBadToken(); - break; + throw GetBadTokenException(); } } } + PathFigure EnsurePathFigure(PathFigure? pathFigure) + { + if (pathFigure is null) + { + throw GetBadTokenException(); + } + else + { + return pathFigure; + } + } + void EnsureFigure() { if (!figureStarted) + { figureStarted = true; + } } Point Reflect() @@ -334,11 +347,6 @@ Point Reflect() 2 * lastPoint.Y - secondLastPoint.Y); } - - - - - bool More() { return currentIndex < pathLength; @@ -368,7 +376,7 @@ bool SkipWhiteSpace(bool allowComma) } else { - ThrowBadToken(); + throw GetBadTokenException(); } break; @@ -405,9 +413,7 @@ bool ReadBool() } } - ThrowBadToken(); - - return false; + throw GetBadTokenException(); } bool ReadToken() @@ -427,9 +433,9 @@ bool ReadToken() } } - void ThrowBadToken() + Exception GetBadTokenException() { - throw new FormatException(string.Format("UnexpectedToken \"{0}\" into {1}", currentPathString, currentIndex - 1)); + return new FormatException(string.Format("UnexpectedToken \"{0}\" into {1}", currentPathString, currentIndex - 1)); } Point ReadPoint(char cmd, bool allowcomma) @@ -465,7 +471,7 @@ bool IsNumber(bool allowComma) if (commaMet) // Only allowed between numbers { - ThrowBadToken(); + throw GetBadTokenException(); } return false; @@ -475,7 +481,7 @@ double ReadNumber(bool allowComma) { if (!IsNumber(allowComma)) { - ThrowBadToken(); + throw GetBadTokenException(); } bool simple = true; @@ -674,7 +680,7 @@ private static string ParsePathFigureCollectionToString(PathFigureCollection pat return sb.ToString(); } - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (value is PathFigureCollection pathFigureCollection) { diff --git a/src/Controls/src/Core/Shapes/PathGeometryConverter.cs b/src/Controls/src/Core/Shapes/PathGeometryConverter.cs index 805001dca748..dfe11aba373c 100644 --- a/src/Controls/src/Core/Shapes/PathGeometryConverter.cs +++ b/src/Controls/src/Core/Shapes/PathGeometryConverter.cs @@ -1,4 +1,3 @@ -#nullable disable using System; using System.ComponentModel; using System.Globalization; @@ -8,13 +7,13 @@ namespace Microsoft.Maui.Controls.Shapes /// public class PathGeometryConverter : TypeConverter { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) => sourceType == typeof(string); - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType) => false; - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) { var strValue = value?.ToString(); PathGeometry pathGeometry = new PathGeometry(); @@ -24,7 +23,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c return pathGeometry; } - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) => throw new NotSupportedException(); } } diff --git a/src/Controls/tests/Core.UnitTests/AppThemeTests.cs b/src/Controls/tests/Core.UnitTests/AppThemeTests.cs index adad81dace67..1a336be25a17 100644 --- a/src/Controls/tests/Core.UnitTests/AppThemeTests.cs +++ b/src/Controls/tests/Core.UnitTests/AppThemeTests.cs @@ -1,5 +1,6 @@ using System; using Microsoft.Maui.ApplicationModel; +using Microsoft.Maui.Controls.Shapes; using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; using Xunit; @@ -205,8 +206,8 @@ void validateRadioButtonColors(RadioButton button, SolidColorBrush desiredBrush) { var border = (Border)button.Children[0]; var grid = (Grid)border.Content; - var outerEllipse = (Shapes.Ellipse)grid.Children[0]; - var innerEllipse = (Shapes.Ellipse)grid.Children[1]; + var outerEllipse = (Ellipse)grid.Children[0]; + var innerEllipse = (Ellipse)grid.Children[1]; Assert.Equal(desiredBrush, outerEllipse.Stroke); Assert.Equal(desiredBrush, innerEllipse.Fill); diff --git a/src/Controls/tests/Core.UnitTests/BrushUnitTests.cs b/src/Controls/tests/Core.UnitTests/BrushTypeConverterUnitTests.cs similarity index 90% rename from src/Controls/tests/Core.UnitTests/BrushUnitTests.cs rename to src/Controls/tests/Core.UnitTests/BrushTypeConverterUnitTests.cs index 5bd01b109954..1098669d2a6e 100644 --- a/src/Controls/tests/Core.UnitTests/BrushUnitTests.cs +++ b/src/Controls/tests/Core.UnitTests/BrushTypeConverterUnitTests.cs @@ -4,14 +4,17 @@ namespace Microsoft.Maui.Controls.Core.UnitTests { - - public class BrushUnitTests : BaseTestFixture + public class BrushTypeConverterUnitTests : BaseTestFixture { - BrushTypeConverter _converter; + private readonly BrushTypeConverter _converter = new(); - public BrushUnitTests() + [Fact] + public void ConvertNullTest() { - _converter = new BrushTypeConverter(); + var result = _converter.ConvertFromInvariantString(null); + Assert.NotNull(result); + var brush = Assert.IsType(result); + Assert.Null(brush.Color); } [Theory] diff --git a/src/Controls/tests/Core.UnitTests/ColumnDefinitionCollectionTypeConverterUnitTests.cs b/src/Controls/tests/Core.UnitTests/ColumnDefinitionCollectionTypeConverterUnitTests.cs new file mode 100644 index 000000000000..1ccce4e91930 --- /dev/null +++ b/src/Controls/tests/Core.UnitTests/ColumnDefinitionCollectionTypeConverterUnitTests.cs @@ -0,0 +1,15 @@ +using System; +using Xunit; + +namespace Microsoft.Maui.Controls.Core.UnitTests; + +public class ColumnDefinitionCollectionTypeConverterUnitTests : BaseTestFixture +{ + private readonly ColumnDefinitionCollectionTypeConverter _converter = new(); + + [Fact] + public void ConvertNullTest() + { + Assert.Throws(() => _converter.ConvertFromInvariantString(null)); + } +} \ No newline at end of file diff --git a/src/Controls/tests/Core.UnitTests/PathFigureCollectionTests.cs b/src/Controls/tests/Core.UnitTests/PathFigureCollectionConverterTests.cs similarity index 83% rename from src/Controls/tests/Core.UnitTests/PathFigureCollectionTests.cs rename to src/Controls/tests/Core.UnitTests/PathFigureCollectionConverterTests.cs index a1b7c329da27..9867918818c0 100644 --- a/src/Controls/tests/Core.UnitTests/PathFigureCollectionTests.cs +++ b/src/Controls/tests/Core.UnitTests/PathFigureCollectionConverterTests.cs @@ -4,17 +4,30 @@ namespace Microsoft.Maui.Controls.Core.UnitTests { - public class PathFigureCollectionTests + public class PathFigureCollectionConverterTests { - private readonly PathFigureCollectionConverter _pathFigureCollectionConverter = new(); + private readonly PathFigureCollectionConverter _converter = new(); + + [Fact] + public void ConvertNullTest() + { + var result = _converter.ConvertFromInvariantString(null) as PathFigureCollection; + var resultPath = _converter.ConvertToInvariantString(result); + + Assert.NotNull(result); + Assert.Empty(result); + + Assert.NotNull(resultPath); + Assert.Equal("", resultPath); + } [Theory] [InlineData("M10,100 C100,0 200,200 300,100", "Waveform")] public void ConvertStringToPathFigureCollectionTest(string path, string name) { Console.WriteLine(name); - PathFigureCollection result = _pathFigureCollectionConverter.ConvertFromInvariantString(path) as PathFigureCollection; - string resultPath = _pathFigureCollectionConverter.ConvertToInvariantString(result); + PathFigureCollection result = _converter.ConvertFromInvariantString(path) as PathFigureCollection; + string resultPath = _converter.ConvertToInvariantString(result); Assert.NotNull(result); Assert.NotNull(resultPath); @@ -22,6 +35,28 @@ public void ConvertStringToPathFigureCollectionTest(string path, string name) Assert.Equal(path, resultPath, ignoreCase: true, ignoreWhiteSpaceDifferences: true, ignoreAllWhiteSpace: true); } + [Theory] + [InlineData("l 16", "Move left (relative) with no initial position")] + [InlineData("L 16", "Move left with no initial position")] + [InlineData("h 16", "Move horizontally (relative) with no initial position")] + [InlineData("H 16", "Move horizontally with no initial position")] + [InlineData("v 16", "Move vertically (relative) with no initial position")] + [InlineData("V 16", "Move vertically with no initial position")] + [InlineData("L 100,0", "Line with no initial position")] + [InlineData("a 5 3 20 0 1 8 8", "Arc (relative) with no initial position")] + [InlineData("A 5 3 20 0 1 8 8", "Arc no initial position")] + [InlineData("C 8.4580019,26.747002 10.050002,27.758995 12.013003,27.758995", "Bézier curve with no initial position")] + [InlineData("q 8,2 8,8", "Quadratic Bézier curve (relative) with no initial position")] + [InlineData("Q 8,2 8,8", "Quadratic Bézier curve with no initial position")] + [InlineData("s 7,8 8,4", "Smooth Bézier curve (relative) with no initial position")] + [InlineData("S 7,8 8,4", "Smooth Bézier curve with no initial position")] + public void InvalidInputTest(string path, string name) + { + Console.WriteLine(name); + var e = Assert.Throws(() => _converter.ConvertFromInvariantString(path)); + Assert.StartsWith("UnexpectedToken ", e.Message, StringComparison.Ordinal); + } + [Theory] [InlineData("M8.4580019,25.5 C8.4580019,26.747002 10.050002,27.758995 12.013003,27.758995 C13.977001,27.758995 15.569004,26.747002 15.569004,25.5 Z M19.000005,10 C16.861005,9.9469986 14.527004,12.903999 14.822002,22.133995 C14.822002,22.133995 26.036002,15.072998 20.689,10.681999 C20.183003,10.265999 19.599004,10.014999 19.000005,10 Z M4.2539991,10 C3.6549998,10.014999 3.0710002,10.265999 2.5649996,10.681999 C-2.7820019,15.072998 8.4320009,22.133995 8.4320009,22.133995 C8.7270001,12.903999 6.3929995,9.9469986 4.2539991,10 Z M11.643,0 C18.073003,0 23.286002,5.8619995 23.286002,13.091995 C23.286002,20.321999 18.684003,32 12.254,32 C5.8239992,32 1.8224728E-07,20.321999 0,13.091995 C1.8224728E-07,5.8619995 5.2129987,0 11.643,0 Z", "AlienPathTest")] [InlineData("M16.484421,0.73799322 C20.831404,0.7379931 24.353395,1.1259904 24.353395,1.6049905 C24.353395,2.0839829 20.831404,2.4719803 16.484421,2.47198 C12.138443,2.4719803 8.6154527,2.0839829 8.6154527,1.6049905 C8.6154527,1.1259904 12.138443,0.7379931 16.484421,0.73799322 Z M1.9454784,0.061995983 C2.7564723,5.2449602 12.246436,11.341911 12.246436,11.341911 C13.248431,19.240842 9.6454477,17.915854 9.6454477,17.915854 C7.9604563,18.897849 6.5314603,17.171859 6.5314603,17.171859 C4.1084647,18.29585 3.279473,15.359877 3.2794733,15.359877 C0.82348057,15.291876 1.2804796,11.362907 1.2804799,11.362907 C-1.573514,10.239915 1.2344746,6.3909473 1.2344746,6.3909473 C-1.3255138,4.9869594 1.9454782,0.061996057 1.9454784,0.061995983 Z M30.054371,0 C30.054371,9.8700468E-08 33.325355,4.9249634 30.765367,6.3289513 C30.765367,6.3289513 33.574364,10.177919 30.71837,11.30191 C30.71837,11.30191 31.175369,15.22988 28.721384,15.297872 C28.721384,15.297872 27.892376,18.232854 25.468389,17.110862 C25.468389,17.110862 24.040392,18.835847 22.355402,17.853852 C22.355402,17.853852 18.752417,19.178845 19.753414,11.279907 C19.753414,11.279907 29.243385,5.1829566 30.054371,0 Z", "AngelPathTest")] @@ -34,12 +69,12 @@ public void ConvertStringToPathFigureCollectionTest(string path, string name) public void ComplexPathTest(string path, string name) { Console.WriteLine(name); - PathFigureCollection result = _pathFigureCollectionConverter.ConvertFromInvariantString(path) as PathFigureCollection; + PathFigureCollection result = _converter.ConvertFromInvariantString(path) as PathFigureCollection; Assert.NotNull(result); Assert.NotEmpty(result); - string resultPath = _pathFigureCollectionConverter.ConvertToInvariantString(result); + string resultPath = _converter.ConvertToInvariantString(result); Assert.NotNull(resultPath); Assert.Equal(path, resultPath, ignoreCase: true, ignoreWhiteSpaceDifferences: true, ignoreAllWhiteSpace: true); diff --git a/src/Controls/tests/Core.UnitTests/Shapes/MatrixTypeConverterTests.cs b/src/Controls/tests/Core.UnitTests/Shapes/MatrixTypeConverterTests.cs new file mode 100644 index 000000000000..d31b75542e7a --- /dev/null +++ b/src/Controls/tests/Core.UnitTests/Shapes/MatrixTypeConverterTests.cs @@ -0,0 +1,16 @@ +using Microsoft.Maui.Controls.Shapes; +using System; +using Xunit; + +namespace Microsoft.Maui.Controls.Core.UnitTests.Shapes; + +public class MatrixTypeConverterUnitTests : BaseTestFixture +{ + private readonly MatrixTypeConverter _converter = new(); + + [Fact] + public void ConvertNullTest() + { + Assert.Throws(() => _converter.ConvertFromInvariantString(null)); + } +} \ No newline at end of file diff --git a/src/Controls/tests/Core.UnitTests/Shapes/PathGeometryConverterTests.cs b/src/Controls/tests/Core.UnitTests/Shapes/PathGeometryConverterTests.cs new file mode 100644 index 000000000000..644a44e55c56 --- /dev/null +++ b/src/Controls/tests/Core.UnitTests/Shapes/PathGeometryConverterTests.cs @@ -0,0 +1,18 @@ +using Microsoft.Maui.Controls.Shapes; +using System; +using Xunit; + +namespace Microsoft.Maui.Controls.Core.UnitTests.Shapes; + +public class PathGeometryConverterTests : BaseTestFixture +{ + private readonly PathGeometryConverter _converter = new(); + + [Fact] + public void ConvertNullTest() + { + var result = _converter.ConvertFromInvariantString(null); + var pathGeometry = Assert.IsType(result); + Assert.Empty(pathGeometry.Figures); + } +} \ No newline at end of file