Add input regions APIs
authorWonsik Jung <sidein@samsung.com>
Fri, 6 Aug 2021 09:02:53 +0000 (18:02 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 27 Aug 2021 05:29:50 +0000 (14:29 +0900)
Add input regions APIs about adding input area and subtracting.

src/Tizen.NUI/src/internal/Interop/Interop.Window.cs
src/Tizen.NUI/src/public/Window/Window.cs
test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Window/TSWindow.cs

index 1ac6c4a..2f3b41f 100755 (executable)
@@ -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);
         }
     }
 }
index 2689d8b..160aaf9 100644 (file)
@@ -1506,6 +1506,28 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Adds input region.
+        /// </summary>
+        /// <param name="inputRegion">The added region to accept input events.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void AddInputRegion(Rectangle inputRegion)
+        {
+            Interop.Window.AddInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Subtracts input region.
+        /// </summary>
+        /// <param name="inputRegion">The subtracted region to except input events.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SubtractInputRegion(Rectangle inputRegion)
+        {
+            Interop.Window.SubtractInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Add FrameUpdateCallback
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 8d43d0e..da9e336 100755 (executable)
@@ -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
+}