diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml
index 7221fe4657..194367c076 100644
--- a/azure-pipelines-integrationtests.yml
+++ b/azure-pipelines-integrationtests.yml
@@ -15,11 +15,12 @@ jobs:
version: 7.0.101
- script: system_profiler SPDisplaysDataType |grep Resolution
+ displayName: 'Get Resolution'
- script: |
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
pkill node
- appium &
+ appium > appium.out &
pkill IntegrationTestApp
./build.sh CompileNative
rm -rf $(osascript -e "POSIX path of (path to application id \"net.avaloniaui.avalonia.integrationtestapp\")")
@@ -27,16 +28,23 @@ jobs:
./samples/IntegrationTestApp/bundle.sh
open -n ./samples/IntegrationTestApp/bin/Debug/net7.0/osx-arm64/publish/IntegrationTestApp.app
pkill IntegrationTestApp
+ displayName: 'Build IntegrationTestApp'
- task: DotNetCoreCLI@2
+ displayName: 'Run Integration Tests'
inputs:
command: 'test'
projects: 'tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj'
+ arguments: '-l "console;verbosity=detailed"'
- script: |
pkill IntegrationTestApp
pkill node
+ displayName: 'Stop Appium'
+ - publish: appium.out
+ displayName: 'Publish appium logs on failure'
+ condition: failed()
- job: Windows
pool:
@@ -60,11 +68,13 @@ jobs:
displayName: 'Start WinAppDriver'
- task: DotNetCoreCLI@2
+ displayName: 'Build IntegrationTestApp'
inputs:
command: 'build'
projects: 'samples/IntegrationTestApp/IntegrationTestApp.csproj'
- task: DotNetCoreCLI@2
+ displayName: 'Run Integration Tests'
retryCountOnTaskFailure: 3
inputs:
command: 'test'
diff --git a/native/Avalonia.Native/src/OSX/Screens.mm b/native/Avalonia.Native/src/OSX/Screens.mm
index 83ab1bfd01..85f4b7c50a 100644
--- a/native/Avalonia.Native/src/OSX/Screens.mm
+++ b/native/Avalonia.Native/src/OSX/Screens.mm
@@ -41,7 +41,7 @@ public:
ret->WorkingArea.X = [screen visibleFrame].origin.x;
ret->WorkingArea.Y = ConvertPointY(ToAvnPoint([screen visibleFrame].origin)).Y - ret->WorkingArea.Height;
- ret->Scaling = [screen backingScaleFactor];
+ ret->Scaling = 1;
ret->IsPrimary = index == 0;
diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs
index 3704cee890..46f267ae17 100644
--- a/nukebuild/Build.cs
+++ b/nukebuild/Build.cs
@@ -165,10 +165,10 @@ partial class Build : NukeBuild
foreach (var fw in targetFrameworks)
{
if (fw.StartsWith("net4")
- && RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
+ && (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
&& Environment.GetEnvironmentVariable("FORCE_LINUX_TESTS") != "1")
{
- Information($"Skipping {projectName} ({fw}) tests on Linux - https://github.com/mono/mono/issues/13969");
+ Information($"Skipping {projectName} ({fw}) tests on *nix - https://github.com/mono/mono/issues/13969");
continue;
}
diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj
index 056d3bf552..f094c0081c 100644
--- a/samples/BindingDemo/BindingDemo.csproj
+++ b/samples/BindingDemo/BindingDemo.csproj
@@ -5,6 +5,7 @@
+
diff --git a/samples/GpuInterop/GpuInterop.csproj b/samples/GpuInterop/GpuInterop.csproj
index 88e6d3d283..161821d92a 100644
--- a/samples/GpuInterop/GpuInterop.csproj
+++ b/samples/GpuInterop/GpuInterop.csproj
@@ -15,6 +15,7 @@
+
diff --git a/samples/MobileSandbox/MobileSandbox.csproj b/samples/MobileSandbox/MobileSandbox.csproj
index 02e4c43960..0d7c7859f8 100644
--- a/samples/MobileSandbox/MobileSandbox.csproj
+++ b/samples/MobileSandbox/MobileSandbox.csproj
@@ -28,6 +28,7 @@
+
diff --git a/samples/PlatformSanityChecks/PlatformSanityChecks.csproj b/samples/PlatformSanityChecks/PlatformSanityChecks.csproj
index 5f61a08f3c..40efe818d8 100644
--- a/samples/PlatformSanityChecks/PlatformSanityChecks.csproj
+++ b/samples/PlatformSanityChecks/PlatformSanityChecks.csproj
@@ -7,6 +7,7 @@
+
diff --git a/samples/Previewer/Previewer.csproj b/samples/Previewer/Previewer.csproj
index 76c1ba7b69..b572c3e4f8 100644
--- a/samples/Previewer/Previewer.csproj
+++ b/samples/Previewer/Previewer.csproj
@@ -10,6 +10,7 @@
+
diff --git a/samples/ReactiveUIDemo/ReactiveUIDemo.csproj b/samples/ReactiveUIDemo/ReactiveUIDemo.csproj
index 9650068434..0e054d6c36 100644
--- a/samples/ReactiveUIDemo/ReactiveUIDemo.csproj
+++ b/samples/ReactiveUIDemo/ReactiveUIDemo.csproj
@@ -7,6 +7,7 @@
+
diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj
index 3c62af1eaf..b37ecf01b9 100644
--- a/samples/RenderDemo/RenderDemo.csproj
+++ b/samples/RenderDemo/RenderDemo.csproj
@@ -12,6 +12,7 @@
+
diff --git a/samples/Sandbox/Sandbox.csproj b/samples/Sandbox/Sandbox.csproj
index eab654acb6..f23e391a2a 100644
--- a/samples/Sandbox/Sandbox.csproj
+++ b/samples/Sandbox/Sandbox.csproj
@@ -10,6 +10,7 @@
+
diff --git a/samples/VirtualizationDemo/VirtualizationDemo.csproj b/samples/VirtualizationDemo/VirtualizationDemo.csproj
index b27cfe77e8..81b30c6cbe 100644
--- a/samples/VirtualizationDemo/VirtualizationDemo.csproj
+++ b/samples/VirtualizationDemo/VirtualizationDemo.csproj
@@ -5,6 +5,7 @@
+
diff --git a/src/Avalonia.Base/AttachedProperty.cs b/src/Avalonia.Base/AttachedProperty.cs
index 31b6cad8ab..4a09f2a80a 100644
--- a/src/Avalonia.Base/AttachedProperty.cs
+++ b/src/Avalonia.Base/AttachedProperty.cs
@@ -32,9 +32,14 @@ namespace Avalonia
///
/// The owner type.
/// The property.
- public new AttachedProperty AddOwner() where TOwner : AvaloniaObject
+ public new AttachedProperty AddOwner(StyledPropertyMetadata? metadata = null) where TOwner : AvaloniaObject
{
AvaloniaPropertyRegistry.Instance.Register(typeof(TOwner), this);
+ if (metadata != null)
+ {
+ OverrideMetadata(metadata);
+ }
+
return this;
}
}
diff --git a/src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs b/src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs
index a202d6b5bc..3b9b2d0de6 100644
--- a/src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs
+++ b/src/Avalonia.Base/Input/GestureRecognizers/GestureRecognizerCollection.cs
@@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.LogicalTree;
-using Avalonia.Styling;
+using Avalonia.Reactive;
namespace Avalonia.Input.GestureRecognizers
{
@@ -11,13 +11,13 @@ namespace Avalonia.Input.GestureRecognizers
private readonly IInputElement _inputElement;
private List? _recognizers;
private Dictionary? _pointerGrabs;
-
-
+
+
public GestureRecognizerCollection(IInputElement inputElement)
{
_inputElement = inputElement;
}
-
+
public void Add(IGestureRecognizer recognizer)
{
if (_recognizers == null)
@@ -31,14 +31,13 @@ namespace Avalonia.Input.GestureRecognizers
recognizer.Initialize(_inputElement, this);
// Hacks to make bindings work
-
+
if (_inputElement is ILogical logicalParent && recognizer is ISetLogicalParent logical)
{
logical.SetParent(logicalParent);
if (recognizer is StyledElement styleableRecognizer
&& _inputElement is StyledElement styleableParent)
- styleableRecognizer.Bind(StyledElement.TemplatedParentProperty,
- styleableParent.GetObservable(StyledElement.TemplatedParentProperty));
+ styleableParent.GetObservable(StyledElement.TemplatedParentProperty).Subscribe(parent => styleableRecognizer.TemplatedParent = parent);
}
}
@@ -58,7 +57,7 @@ namespace Avalonia.Input.GestureRecognizers
return false;
foreach (var r in _recognizers)
{
- if(e.Handled)
+ if (e.Handled)
break;
r.PointerPressed(e);
}
diff --git a/src/Avalonia.Base/Input/GestureRecognizers/PullGestureRecognizer.cs b/src/Avalonia.Base/Input/GestureRecognizers/PullGestureRecognizer.cs
index 991694cc60..6784677520 100644
--- a/src/Avalonia.Base/Input/GestureRecognizers/PullGestureRecognizer.cs
+++ b/src/Avalonia.Base/Input/GestureRecognizers/PullGestureRecognizer.cs
@@ -13,22 +13,18 @@ namespace Avalonia.Input
private Point _initialPosition;
private int _gestureId;
private IPointer? _tracking;
- private PullDirection _pullDirection;
private bool _pullInProgress;
///
/// Defines the property.
///
- public static readonly DirectProperty PullDirectionProperty =
- AvaloniaProperty.RegisterDirect(
- nameof(PullDirection),
- o => o.PullDirection,
- (o, v) => o.PullDirection = v);
+ public static readonly StyledProperty PullDirectionProperty =
+ AvaloniaProperty.Register(nameof(PullDirection));
public PullDirection PullDirection
{
- get => _pullDirection;
- set => SetAndRaise(PullDirectionProperty, ref _pullDirection, value);
+ get => GetValue(PullDirectionProperty);
+ set => SetValue(PullDirectionProperty, value);
}
public PullGestureRecognizer(PullDirection pullDirection)
diff --git a/src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs b/src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
index 7c1ee13eed..1ad2f292ca 100644
--- a/src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
+++ b/src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
@@ -17,61 +17,45 @@ namespace Avalonia.Input.GestureRecognizers
private IPointer? _tracking;
private IInputElement? _target;
private IGestureRecognizerActionsDispatcher? _actions;
- private bool _canHorizontallyScroll;
- private bool _canVerticallyScroll;
private int _gestureId;
- private int _scrollStartDistance = 30;
private Point _pointerPressedPoint;
private VelocityTracker? _velocityTracker;
// Movement per second
private Vector _inertia;
private ulong? _lastMoveTimestamp;
- private bool _isScrollInertiaEnabled;
///
/// Defines the property.
///
- public static readonly DirectProperty CanHorizontallyScrollProperty =
- AvaloniaProperty.RegisterDirect(
- nameof(CanHorizontallyScroll),
- o => o.CanHorizontallyScroll,
- (o, v) => o.CanHorizontallyScroll = v);
+ public static readonly StyledProperty CanHorizontallyScrollProperty =
+ AvaloniaProperty.Register(nameof(CanHorizontallyScroll));
///
/// Defines the property.
///
- public static readonly DirectProperty CanVerticallyScrollProperty =
- AvaloniaProperty.RegisterDirect(
- nameof(CanVerticallyScroll),
- o => o.CanVerticallyScroll,
- (o, v) => o.CanVerticallyScroll = v);
+ public static readonly StyledProperty CanVerticallyScrollProperty =
+ AvaloniaProperty.Register(nameof(CanVerticallyScroll));
///
/// Defines the property.
///
- public static readonly DirectProperty IsScrollInertiaEnabledProperty =
- AvaloniaProperty.RegisterDirect(
- nameof(IsScrollInertiaEnabled),
- o => o.IsScrollInertiaEnabled,
- (o, v) => o.IsScrollInertiaEnabled = v);
+ public static readonly StyledProperty IsScrollInertiaEnabledProperty =
+ AvaloniaProperty.Register(nameof(IsScrollInertiaEnabled));
///
/// Defines the property.
///
- public static readonly DirectProperty ScrollStartDistanceProperty =
- AvaloniaProperty.RegisterDirect(
- nameof(ScrollStartDistance),
- o => o.ScrollStartDistance,
- (o, v) => o.ScrollStartDistance = v);
+ public static readonly StyledProperty ScrollStartDistanceProperty =
+ AvaloniaProperty.Register(nameof(ScrollStartDistance), 30);
///
/// Gets or sets a value indicating whether the content can be scrolled horizontally.
///
public bool CanHorizontallyScroll
{
- get => _canHorizontallyScroll;
- set => SetAndRaise(CanHorizontallyScrollProperty, ref _canHorizontallyScroll, value);
+ get => GetValue(CanHorizontallyScrollProperty);
+ set => SetValue(CanHorizontallyScrollProperty, value);
}
///
@@ -79,8 +63,8 @@ namespace Avalonia.Input.GestureRecognizers
///
public bool CanVerticallyScroll
{
- get => _canVerticallyScroll;
- set => SetAndRaise(CanVerticallyScrollProperty, ref _canVerticallyScroll, value);
+ get => GetValue(CanVerticallyScrollProperty);
+ set => SetValue(CanVerticallyScrollProperty, value);
}
///
@@ -88,8 +72,8 @@ namespace Avalonia.Input.GestureRecognizers
///
public bool IsScrollInertiaEnabled
{
- get => _isScrollInertiaEnabled;
- set => SetAndRaise(IsScrollInertiaEnabledProperty, ref _isScrollInertiaEnabled, value);
+ get => GetValue(IsScrollInertiaEnabledProperty);
+ set => SetValue(IsScrollInertiaEnabledProperty, value);
}
///
@@ -97,8 +81,8 @@ namespace Avalonia.Input.GestureRecognizers
///
public int ScrollStartDistance
{
- get => _scrollStartDistance;
- set => SetAndRaise(ScrollStartDistanceProperty, ref _scrollStartDistance, value);
+ get => GetValue(ScrollStartDistanceProperty);
+ set => SetValue(ScrollStartDistanceProperty, value);
}
@@ -137,8 +121,8 @@ namespace Avalonia.Input.GestureRecognizers
// Correct _trackedRootPoint with ScrollStartDistance, so scrolling does not start with a skip of ScrollStartDistance
_trackedRootPoint = new Point(
- _trackedRootPoint.X - (_trackedRootPoint.X >= rootPoint.X ? _scrollStartDistance : -_scrollStartDistance),
- _trackedRootPoint.Y - (_trackedRootPoint.Y >= rootPoint.Y ? _scrollStartDistance : -_scrollStartDistance));
+ _trackedRootPoint.X - (_trackedRootPoint.X >= rootPoint.X ? ScrollStartDistance : -ScrollStartDistance),
+ _trackedRootPoint.Y - (_trackedRootPoint.Y >= rootPoint.Y ? ScrollStartDistance : -ScrollStartDistance));
_actions!.Capture(e.Pointer, this);
}
diff --git a/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs b/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs
index 525a543b70..8e57f9a902 100644
--- a/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs
+++ b/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs
@@ -48,8 +48,6 @@ namespace Avalonia.Media.Imaging
public CroppedBitmap()
{
- Source = null;
- SourceRect = default;
}
public CroppedBitmap(IImage source, PixelRect sourceRect)
diff --git a/src/Avalonia.Base/StyledElement.cs b/src/Avalonia.Base/StyledElement.cs
index cbdf3c3c1e..b51093b40c 100644
--- a/src/Avalonia.Base/StyledElement.cs
+++ b/src/Avalonia.Base/StyledElement.cs
@@ -67,8 +67,7 @@ namespace Avalonia
public static readonly DirectProperty TemplatedParentProperty =
AvaloniaProperty.RegisterDirect(
nameof(TemplatedParent),
- o => o.TemplatedParent,
- (o ,v) => o.TemplatedParent = v);
+ o => o.TemplatedParent);
///
/// Defines the property.
diff --git a/src/Avalonia.Base/StyledProperty.cs b/src/Avalonia.Base/StyledProperty.cs
index 8695918c18..5052840013 100644
--- a/src/Avalonia.Base/StyledProperty.cs
+++ b/src/Avalonia.Base/StyledProperty.cs
@@ -56,9 +56,14 @@ namespace Avalonia
///
/// The type of the additional owner.
/// The property.
- public StyledProperty AddOwner() where TOwner : AvaloniaObject
+ public StyledProperty AddOwner(StyledPropertyMetadata? metadata = null) where TOwner : AvaloniaObject
{
AvaloniaPropertyRegistry.Instance.Register(typeof(TOwner), this);
+ if (metadata != null)
+ {
+ OverrideMetadata(metadata);
+ }
+
return this;
}
diff --git a/src/Avalonia.Controls/Automation/Peers/LabelAutomationPeer.cs b/src/Avalonia.Controls/Automation/Peers/LabelAutomationPeer.cs
new file mode 100644
index 0000000000..86cd0d5b14
--- /dev/null
+++ b/src/Avalonia.Controls/Automation/Peers/LabelAutomationPeer.cs
@@ -0,0 +1,34 @@
+using Avalonia.Automation.Peers;
+using Avalonia.Controls.Primitives;
+
+namespace Avalonia.Controls.Automation.Peers
+{
+ public class LabelAutomationPeer : ControlAutomationPeer
+ {
+ public LabelAutomationPeer(Label owner) : base(owner)
+ {
+ }
+
+ override protected string GetClassNameCore()
+ {
+ return "Text";
+ }
+
+ override protected AutomationControlType GetAutomationControlTypeCore()
+ {
+ return AutomationControlType.Text;
+ }
+
+ override protected string? GetNameCore()
+ {
+ var content = ((Label)Owner).Content as string;
+
+ if (string.IsNullOrEmpty(content))
+ {
+ return base.GetNameCore();
+ }
+
+ return AccessText.RemoveAccessKeyMarker(content) ?? string.Empty;
+ }
+ }
+}
diff --git a/src/Avalonia.Controls/Button.cs b/src/Avalonia.Controls/Button.cs
index 1ec6f8dabc..f48d7a7cc1 100644
--- a/src/Avalonia.Controls/Button.cs
+++ b/src/Avalonia.Controls/Button.cs
@@ -1,11 +1,9 @@
using System;
-using System.Diagnostics;
using System.Linq;
using System.Windows.Input;
using Avalonia.Automation.Peers;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
-using Avalonia.Controls.Templates;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
@@ -48,9 +46,8 @@ namespace Avalonia.Controls
///
/// Defines the property.
///
- public static readonly DirectProperty