Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP of Accessibility/UI automation support #5177

Merged
merged 86 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2a44d8b
Initial implementation of UI automation.
grokys Mar 9, 2021
c1dfc1f
Started adding integration tests.
grokys Mar 9, 2021
e8801c2
Started adding ComboBox integration tests.
grokys Mar 9, 2021
5f551a2
Make integration tests ordered.
grokys Mar 9, 2021
2e23333
Add CheckBox tests.
grokys Mar 10, 2021
651106a
Use Name for AutomationId.
grokys Mar 11, 2021
8b642a9
Implemented LabeledBy.
grokys Mar 11, 2021
06ed896
Added access/accelerator key support.
grokys Mar 11, 2021
3fcfe4d
Notify UIA that a window has been destroyed.
grokys Mar 11, 2021
bd0d973
Use Group as generic control type.
grokys Mar 11, 2021
acc40a7
Add context menu automation peer.
grokys Mar 11, 2021
7f42229
Don't use C#9 features.
grokys Mar 12, 2021
c876a19
Merge branch 'master' into feature/ui-automation
grokys Mar 21, 2021
8add237
Make root automation node come from OS.
grokys Mar 23, 2021
1c60374
Use correct peer for TabItems.
grokys Mar 26, 2021
a475157
Merge branch 'master' into feature/ui-automation
grokys May 31, 2021
7bb2647
Fix AccessText after merge.
grokys May 31, 2021
d6d583a
Initial implementation of OSX automation.
grokys Mar 26, 2021
bcc8876
Handle children changing.
grokys Mar 26, 2021
7bbbfa4
More OSX accessibility implementation.
grokys Mar 26, 2021
0ab5e4d
Implemented a11y focus on OSX.
grokys Mar 27, 2021
1553b89
Fix a11y for popup windows.
grokys Mar 27, 2021
6096cab
Use correct role for combobox items on OSX.
grokys Mar 27, 2021
8ded356
More work on ComboBox OSX a11y.
grokys Mar 30, 2021
2df1e32
Expose max/min for slider controls etc.
grokys Mar 30, 2021
3f53126
Merge branch 'master' into feature/ui-automation
grokys Sep 28, 2021
7ca502e
Update ApiCompatBaseline.txt
grokys Sep 28, 2021
c34a825
Try to fix problem with ComboBox.
grokys Oct 2, 2021
acb49d6
Revert "Try to fix problem with ComboBox."
grokys Oct 2, 2021
11c60b4
Decouple automation peers from platform nodes.
grokys Oct 2, 2021
8ffbbfb
Create root automation nodes like others.
grokys Oct 2, 2021
ae89057
Use non-obsolete interface.
grokys Oct 2, 2021
26419fc
Added AutomationControlType.None.
grokys Oct 3, 2021
a5c28de
Reinstate ControlAutomationPeerTests.
grokys Oct 3, 2021
54d9ba7
Allow peers to dynamically expose implemented interfaces.
grokys Oct 4, 2021
49ef4b3
Added AccessibilityView and ControlType.
grokys Oct 4, 2021
0756c1b
Use new properties to remove some peers.
grokys Oct 4, 2021
eebcaca
Query correct interface.
grokys Oct 4, 2021
0388a7b
Merge branch 'master' into feature/ui-automation
grokys Oct 21, 2021
f4f478c
Move ChildrenChanged to AutomationPeer.
grokys Oct 28, 2021
651fffd
Merge branch 'master' into feature/ui-automation
grokys Nov 7, 2021
bc12867
Make OSX a11y work again.
grokys Nov 10, 2021
ab15b8e
Try to prevent leaks.
grokys Nov 10, 2021
af588cc
Stop warning.
grokys Nov 10, 2021
dab63d3
Merge branch 'master' into feature/ui-automation
grokys Nov 11, 2021
e253b6c
Merge branch 'master' into feature/ui-automation
grokys Nov 12, 2021
e0d3799
Update IntegrationTestApp to net6.0.
grokys Nov 12, 2021
77f535f
Trying to use a shared project for win32/mac integration tests.
grokys Nov 12, 2021
32e76d3
WIP: Bundle IntegrationTestApp.
grokys Nov 12, 2021
9b9abb2
Added script to create bundle.
grokys Nov 12, 2021
cab21b6
Start making automation tests work on macOS.
grokys Nov 12, 2021
71b84b3
Correctly raise layout changed notification (?)
grokys Nov 13, 2021
812bf26
Get CheckBox automation tests passing on macOS.
grokys Nov 13, 2021
8250131
Rename integration tests now they're not win32-only.
grokys Nov 13, 2021
66923cd
Skip accelerator key test on OSX.
grokys Nov 20, 2021
6b17707
Raise focus changed on new window if it has focus.
grokys Nov 20, 2021
f4d9d4c
Make integration tests pass on MacOS.
grokys Nov 21, 2021
dc83f8e
Use ListItemAutomationPeer for TabItem.
grokys Nov 21, 2021
5534e66
Implement isAccessibilitySelected.
grokys Nov 21, 2021
610ef6f
Added a NativeMenu test for macOS.
grokys Nov 21, 2021
f6e06a6
Refactored Menu integration tests.
grokys Nov 21, 2021
742d960
Remove rogue character.
grokys Nov 21, 2021
33ca12c
Remove faulty cast.
grokys Nov 21, 2021
ddb6ab9
Refactored ComboBox integration tests.
grokys Nov 22, 2021
26137ca
Trying to get stuff working on macOS.
grokys Nov 22, 2021
b4a183b
Skip keyboard interaction tests on macOS.
grokys Nov 22, 2021
261f46e
Added a few ListBox tests.
grokys Nov 23, 2021
9f807c9
Sigh. Appium sucks.
grokys Nov 23, 2021
6da59f9
Added integration tests readme.
grokys Nov 23, 2021
bfbe425
Merge branch 'master' into feature/ui-automation
grokys Nov 23, 2021
e89bd58
Add additional macOS prerequisite.
grokys Nov 23, 2021
7f8624e
Updated ApiCompat.
grokys Nov 24, 2021
26eaa8d
Merge branch 'master' into feature/ui-automation
jmacato Nov 27, 2021
cc4cfa6
Throw when interface not supported.
grokys Nov 30, 2021
98a070e
Implement provider members as explicit interface members.
grokys Nov 30, 2021
1d665c5
Fix leak in GetNSStringAndRelease.
grokys Dec 3, 2021
bff4616
Don't run integration tests under ncrunch.
grokys Dec 5, 2021
3194d45
Merge branch 'master' into feature/ui-automation
grokys Jan 27, 2022
09e3261
Changed by VS.
grokys Jan 27, 2022
7581ce2
Remove non-existent project.
grokys Jan 28, 2022
72beb30
Cast to interface instead of concrete type.
grokys Jan 28, 2022
d6b09a9
Use correct interface for root window impl.
grokys Feb 23, 2022
7a9d21f
Merge branch 'master' into feature/ui-automation
grokys Feb 24, 2022
b9f9d4d
Fix nullable errors after merge.
grokys Feb 24, 2022
b2eddaa
Merge branch 'master' into feature/ui-automation
grokys Feb 25, 2022
b244197
Merge branch 'master' into feature/ui-automation
grokys Mar 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ space_within_single_line_array_initializer_braces = true
csharp_wrap_before_ternary_opsigns = false

# Xaml files
[*.xaml]
[*.{xaml,axaml}]
indent_size = 2

# Xml project files
Expand Down
5 changes: 5 additions & 0 deletions .ncrunch/Avalonia.IntegrationTests.Appium.v3.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
</Settings>
</ProjectConfiguration>
5 changes: 5 additions & 0 deletions .ncrunch/Avalonia.IntegrationTests.Win32.v3.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
</Settings>
</ProjectConfiguration>
5 changes: 5 additions & 0 deletions .ncrunch/IntegrationTestApp.v3.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
</Settings>
</ProjectConfiguration>
55 changes: 55 additions & 0 deletions Avalonia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.MicroCom", "src\Av
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniMvvm", "samples\MiniMvvm\MiniMvvm.csproj", "{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTestApp", "samples\IntegrationTestApp\IntegrationTestApp.csproj", "{676D6BFD-029D-4E43-BFC7-3892265CE251}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.IntegrationTests.Appium", "tests\Avalonia.IntegrationTests.Appium\Avalonia.IntegrationTests.Appium.csproj", "{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Web.Blazor", "src\Web\Avalonia.Web.Blazor\Avalonia.Web.Blazor.csproj", "{25831348-EB2A-483E-9576-E8F6528674A5}"
Expand Down Expand Up @@ -2037,6 +2041,54 @@ Global
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.Build.0 = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhone.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|Any CPU.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhone.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|Any CPU.ActiveCfg = Release|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|Any CPU.Build.0 = Release|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhone.ActiveCfg = Release|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhone.Build.0 = Release|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhone.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhone.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|Any CPU.Build.0 = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhone.ActiveCfg = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhone.Build.0 = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -2195,6 +2247,7 @@ Global
{29132311-1848-4FD6-AE0C-4FF841151BD3} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{7D2D3083-71DD-4CC9-8907-39A0D86FB322} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
{39D7B147-1A5B-47C2-9D01-21FB7C47C4B3} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{86C53C40-57AA-45B8-AD42-FAE0EFDF0F2B} = {A689DEF5-D50F-4975-8B72-124C9EB54066}
{854568D5-13D1-4B4F-B50D-534DC7EFD3C9} = {86C53C40-57AA-45B8-AD42-FAE0EFDF0F2B}
{638580B0-7910-40EF-B674-DCB34DA308CD} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
{CBC4FF2F-92D4-420B-BE21-9FE0B930B04E} = {B39A8919-9F95-48FE-AD7B-76E08B509888}
Expand All @@ -2214,6 +2267,8 @@ Global
{909A8CBD-7D0E-42FD-B841-022AD8925820} = {8B6A8209-894F-4BA1-B880-965FD453982C}
{11BE52AF-E2DD-4CF0-B19A-05285ACAF571} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{676D6BFD-029D-4E43-BFC7-3892265CE251} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
{25831348-EB2A-483E-9576-E8F6528674A5} = {86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}
{C08E9894-AA92-426E-BF56-033E262CAD3E} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{26A98DA1-D89D-4A95-8152-349F404DA2E2} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
Expand Down
18 changes: 9 additions & 9 deletions build/XUnit.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="xunit" Version="2.3.0" />
<PackageReference Include="xunit.abstractions" Version="2.0.1" />
<PackageReference Include="xunit.assert" Version="2.3.0" />
<PackageReference Include="xunit.core" Version="2.3.0" />
<PackageReference Include="xunit.extensibility.core" Version="2.3.0" />
<PackageReference Include="xunit.extensibility.execution" Version="2.3.0" />
<PackageReference Include="xunit.runner.console" Version="2.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.6" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="xunit.core" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.core" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
</ItemGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
AB661C1E2148230F00291242 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB661C1D2148230F00291242 /* AppKit.framework */; };
AB661C202148286E00291242 /* window.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB661C1F2148286E00291242 /* window.mm */; };
AB8F7D6B21482D7F0057DBA5 /* platformthreading.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8F7D6A21482D7F0057DBA5 /* platformthreading.mm */; };
BC11A5BE2608D58F0017BAD0 /* automation.h in Headers */ = {isa = PBXBuildFile; fileRef = BC11A5BC2608D58F0017BAD0 /* automation.h */; };
BC11A5BF2608D58F0017BAD0 /* automation.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC11A5BD2608D58F0017BAD0 /* automation.mm */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -64,6 +66,8 @@
AB661C212148288600291242 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
AB7A61EF2147C815003C5833 /* libAvalonia.Native.OSX.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libAvalonia.Native.OSX.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
AB8F7D6A21482D7F0057DBA5 /* platformthreading.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = platformthreading.mm; sourceTree = "<group>"; };
BC11A5BC2608D58F0017BAD0 /* automation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = automation.h; sourceTree = "<group>"; };
BC11A5BD2608D58F0017BAD0 /* automation.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = automation.mm; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -97,6 +101,8 @@
AB7A61E62147C814003C5833 = {
isa = PBXGroup;
children = (
BC11A5BC2608D58F0017BAD0 /* automation.h */,
BC11A5BD2608D58F0017BAD0 /* automation.mm */,
1A1852DB23E05814008F0DED /* deadlock.mm */,
1A002B9D232135EE00021753 /* app.mm */,
37DDA9B121933371002E132B /* AvnString.h */,
Expand Down Expand Up @@ -143,6 +149,7 @@
buildActionMask = 2147483647;
files = (
37155CE4233C00EB0034DCE9 /* menu.h in Headers */,
BC11A5BE2608D58F0017BAD0 /* automation.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -213,6 +220,7 @@
AB8F7D6B21482D7F0057DBA5 /* platformthreading.mm in Sources */,
1A3E5EA823E9E83B00EDE661 /* rendertarget.mm in Sources */,
1A3E5EAE23E9FB1300EDE661 /* cgl.mm in Sources */,
BC11A5BF2608D58F0017BAD0 /* automation.mm in Sources */,
37E2330F21583241000CB7E2 /* KeyTransform.mm in Sources */,
520624B322973F4100C4DCEF /* menu.mm in Sources */,
37A517B32159597E00FBA241 /* Screens.mm in Sources */,
Expand Down
1 change: 1 addition & 0 deletions native/Avalonia.Native/src/OSX/AvnString.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ extern IAvnStringArray* CreateAvnStringArray(NSArray<NSString*>* array);
extern IAvnStringArray* CreateAvnStringArray(NSArray<NSURL*>* array);
extern IAvnStringArray* CreateAvnStringArray(NSString* string);
extern IAvnString* CreateByteArray(void* data, int len);
extern NSString* GetNSStringAndRelease(IAvnString* s);
#endif /* AvnString_h */
16 changes: 16 additions & 0 deletions native/Avalonia.Native/src/OSX/AvnString.mm
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,19 @@ virtual HRESULT Get(unsigned int index, IAvnString**ppv) override
{
return new AvnStringImpl(data, len);
}

NSString* GetNSStringAndRelease(IAvnString* s)
{
NSString* result = nil;

if (s != nullptr)
{
char* p;
if (s->Pointer((void**)&p) == S_OK && p != nullptr)
result = [NSString stringWithUTF8String:p];

s->Release();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait... This never releases when the NSString returns above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks like a mistake 👍

}

return result;
}
12 changes: 12 additions & 0 deletions native/Avalonia.Native/src/OSX/automation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import <Cocoa/Cocoa.h>
#include "window.h"

NS_ASSUME_NONNULL_BEGIN

class IAvnAutomationPeer;

@interface AvnAccessibilityElement : NSAccessibilityElement
+ (AvnAccessibilityElement *) acquire:(IAvnAutomationPeer *) peer;
@end

NS_ASSUME_NONNULL_END
Loading