mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-24 10:12:35 +08:00
fix(ColorPicker): correct gradient track active thumb property owner
This commit is contained in:
@@ -13,7 +13,7 @@ internal class GradientColorPickerTrack : AbstractColorPickerSliderTrack
|
||||
GradientColorSlider.GradientValueProperty.AddOwner<GradientColorPickerTrack>();
|
||||
|
||||
public static readonly StyledProperty<GradientColorSliderThumb?> ActivatedThumbProperty =
|
||||
AvaloniaProperty.Register<GradientColorSlider, GradientColorSliderThumb?>(nameof(ActivatedThumb));
|
||||
AvaloniaProperty.Register<GradientColorPickerTrack, GradientColorSliderThumb?>(nameof(ActivatedThumb));
|
||||
|
||||
public LinearGradientBrush? GradientValue
|
||||
{
|
||||
@@ -369,4 +369,4 @@ internal class GradientColorPickerTrack : AbstractColorPickerSliderTrack
|
||||
public void Dispose() => _owner._ignoringPropertyChanged = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -14,6 +14,7 @@ internal static partial class Program
|
||||
VerifyColorPickerHoverIgnoresClickHandler(failures);
|
||||
VerifyColorPickerFocusTrigger(failures);
|
||||
VerifyColorPickerTriggerSubscriptionLifecycle(failures);
|
||||
VerifyGradientColorPickerTrackPropertyOwner(failures);
|
||||
|
||||
if (failures.Count == 0)
|
||||
{
|
||||
@@ -99,6 +100,19 @@ internal static partial class Program
|
||||
failures);
|
||||
}
|
||||
|
||||
private static void VerifyGradientColorPickerTrackPropertyOwner(ICollection<string> failures)
|
||||
{
|
||||
var trackType = Type.GetType(
|
||||
"AtomUI.Desktop.Controls.GradientColorPickerTrack, AtomUI.Desktop.Controls.ColorPicker");
|
||||
var property = trackType?
|
||||
.GetField("ActivatedThumbProperty", BindingFlags.Public | BindingFlags.Static)?
|
||||
.GetValue(null) as Avalonia.AvaloniaProperty;
|
||||
|
||||
Expect(trackType is not null && property?.OwnerType == trackType,
|
||||
$"GradientColorPickerTrack.ActivatedThumbProperty should be registered on GradientColorPickerTrack. Actual owner: {property?.OwnerType.FullName ?? "<null>"}.",
|
||||
failures);
|
||||
}
|
||||
|
||||
private static bool GetColorPickerIsOpen(AbstractColorPicker picker)
|
||||
=> GetColorPickerProperty<bool>(picker, "IsPickerOpen");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user