[NUI] Propagate AutomationId value to DALi (#4426)
authorArtur Świgoń <aswigon@yandex.com>
Thu, 21 Jul 2022 12:08:45 +0000 (14:08 +0200)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Mon, 25 Jul 2022 08:33:12 +0000 (17:33 +0900)
Co-authored-by: Artur Świgoń <a.swigon@samsung.com>
Due to an oversight in #4389, the automationId attribute disappeared from the AT-SPI tree for some Views, causing multiple regressions in Aurum tests. This PR fixes this bug.

The "automationId" key set in AccessibilityAttributes is ignored for controls not backed by a NUIViewAccessible (e.g. BaseComponents, FluxView etc.), because NUIViewAccessible::GetAttributes is never called for such controls. The value of AutomationId should be propagated to dali-toolkit instead, so that is it visible to ControlAccessible::GetAttributes, therefore having an effect for all types of Views (NUIViewAccessible::GetAttributes calls ControlAccessible::GetAttributes first, and then collects any additional attributes stored in View.AccessibilityAttributes).

Dependencies:

    https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/278352/ (merged)
    https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/278353/ (merged)

src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityProperties.cs
src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs

index 080fd68..475606f 100755 (executable)
@@ -98,6 +98,9 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_HIDDEN_get")]
             public static extern int AccessibilityHiddenGet();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_AUTOMATION_ID_get")]
+            public static extern int AutomationIdGet();
         }
     }
 }
index 5eb7340..73d1bbf 100755 (executable)
@@ -153,15 +153,5 @@ namespace Tizen.NUI.BaseComponents
                 NotifyPropertyChanged();
             }
         }
-
-        private string InternalAutomationId
-        {
-            get { return base.AutomationId; }
-            set
-            {
-                base.AutomationId = value;
-                AccessibilityAttributes["automationId"] = value;
-            }
-        }
     }
 }
index 7bd4546..18764d6 100755 (executable)
@@ -2509,13 +2509,15 @@ namespace Tizen.NUI.BaseComponents
             var instance = (Tizen.NUI.BaseComponents.View)bindable;
             if (newValue != null)
             {
-                instance.InternalAutomationId = (string)newValue;
+                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)instance.SwigCPtr, View.Property.AutomationId, new Tizen.NUI.PropertyValue((string)newValue));
             }
         },
         defaultValueCreator: (bindable) =>
         {
             var instance = (Tizen.NUI.BaseComponents.View)bindable;
-            return instance.InternalAutomationId;
+            string temp = "";
+            Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)instance.SwigCPtr, View.Property.AutomationId).Get(out temp);
+            return temp;
         });
 
         /// <summary>
index d2236bc..b9a0342 100755 (executable)
@@ -259,6 +259,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int AccessibilityAttributes = Interop.ViewProperty.AccessibilityAttributesGet();
             internal static readonly int DispatchKeyEvents = Interop.ViewProperty.DispatchKeyEventsGet();
             internal static readonly int AccessibilityHidden = Interop.ViewProperty.AccessibilityHiddenGet();
+            internal static readonly int AutomationId = Interop.ViewProperty.AutomationIdGet();
         }
     }
 }