[NUI] Fix ControlState equality issue. (#1795)
authorJiyun Yang <ji.yang@samsung.com>
Fri, 3 Jul 2020 06:30:35 +0000 (15:30 +0900)
committerGitHub <noreply@github.com>
Fri, 3 Jul 2020 06:30:35 +0000 (15:30 +0900)
This patch fixes such code working well.
```
ControlState a = ControlState.Normal + ControlState.Selected;

a == ControlState.Selected; // This should be true.

```

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/ControlState.cs

index 06aa976..c844f06 100644 (file)
@@ -149,6 +149,11 @@ namespace Tizen.NUI.BaseComponents
 
             newState.stateList = newState.stateList.Distinct().ToList();
 
+            if (newState.stateList.Count == 1)
+            {
+                return newState.stateList[0];
+            }
+
             return newState;
         }