From 2e479c0ca2edbd2d2aec2cba53a6eca2687d0766 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Fri, 6 Aug 2021 18:02:53 +0900 Subject: [PATCH] Add input regions APIs Add input regions APIs about adding input area and subtracting. --- .../src/internal/Interop/Interop.Window.cs | 6 +++ src/Tizen.NUI/src/public/Window/Window.cs | 22 ++++++++ .../testcase/public/Window/TSWindow.cs | 58 ++++++++++++++++++++-- 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index 1ac6c4a..2f3b41f 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -259,6 +259,12 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetWindow")] public static extern global::System.IntPtr Get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_AddInputRegion")] + public static extern void AddInputRegion(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SubtractInputRegion")] + public static extern void SubtractInputRegion(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); } } } diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index 2689d8b..160aaf9 100644 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -1506,6 +1506,28 @@ namespace Tizen.NUI } /// + /// Adds input region. + /// + /// The added region to accept input events. + [EditorBrowsable(EditorBrowsableState.Never)] + public void AddInputRegion(Rectangle inputRegion) + { + Interop.Window.AddInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Subtracts input region. + /// + /// The subtracted region to except input events. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SubtractInputRegion(Rectangle inputRegion) + { + Interop.Window.SubtractInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Add FrameUpdateCallback /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Window/TSWindow.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Window/TSWindow.cs index 8d43d0e..da9e336 100755 --- a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Window/TSWindow.cs +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Window/TSWindow.cs @@ -576,14 +576,15 @@ namespace Tizen.NUI.Devel.Tests try { Window.Instance.EnableFloatingMode(true); + } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } - - tlog.Debug(tag, $"WindowEnableFloatingMode END (OK)"); + tlog.Debug(tag, $"AddInputRegionTest END (OK)"); + } } [Test] @@ -605,7 +606,6 @@ namespace Tizen.NUI.Devel.Tests tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } - tlog.Debug(tag, $"WindowRequestMoveToServer END (OK)"); } @@ -628,8 +628,56 @@ namespace Tizen.NUI.Devel.Tests tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } + tlog.Debug(tag, $"WindowRequestMoveToServer END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Window AddInputRegion Test")] + [Property("SPEC", "Tizen.NUI.Window.AddInputRegion M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + public void AddInputRegionTest() + { + tlog.Debug(tag, $"AddInputRegionTest START"); + try + { + Rectangle inputRegion = new Rectangle(0, 0, 720, 640); + myWin.AddInputRegionTest(inputRegion); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception : Failed!"); + } + tlog.Debug(tag, $"AddInputRegionTest END (OK)"); + } + + + [Test] + [Category("P1")] + [Description("Window SubtractInputRegion Test")] + [Property("SPEC", "Tizen.NUI.Window.SubtractInputRegion M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + public void SubtractInputRegionTest() + { + tlog.Debug(tag, $"SubtractInputRegionTest START"); + try + { + Rectangle addInputRegion = new Rectangle(0, 0, 720, 1280); + myWin.AddInputRegionTest(addInputRegion); + + Rectangle subtractInputRegion = new Rectangle(0, 641, 720, 640); + myWin.AddInputRegionTest(subtractInputRegion); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception : Failed!"); + } - tlog.Debug(tag, $"WindowRequestResizeToServer END (OK)"); + tlog.Debug(tag, $"SubtractInputRegionTest END (OK)"); } } -} \ No newline at end of file +} -- 2.7.4