Exemple #1
0
        public void GetValuesEnumerablePasses()
        {
            var data = new TouchFrameInputData();

            AssertionUtils.AssertEnumerableByUnordered(
                Enumerable.Range(0, TouchFrameInputData.LIMIT_TOUCH_COUNT)
                .Select(_i => (_i.ToString(), data.GetTouch(_i).RawValue))
                .Concat(
                    new (string key, object value)[]
Exemple #2
0
        public void PropertiesPasses()
        {
            var data = new TouchFrameInputData();

            {//TouchSupported
                data.TouchSupported = !data.TouchSupported;
                var observer = data.GetValuesEnumerable()
                               .First(_t => _t.Key == TouchFrameInputData.KeyTouchSupported)
                               .Value;
                Assert.AreEqual(data.TouchSupported, observer.RawValue);
                Assert.IsTrue(observer.DidUpdated);
            }
            Debug.Log($"Success to TouchSupported!");

            {//TouchPressureSupported
                data.TouchPressureSupported = !data.TouchPressureSupported;
                var observer = data.GetValuesEnumerable()
                               .First(_t => _t.Key == TouchFrameInputData.KeyTouchPressureSupported)
                               .Value;
                Assert.AreEqual(data.TouchPressureSupported, observer.RawValue);
                Assert.IsTrue(observer.DidUpdated);
            }
            Debug.Log($"Success to TouchPressureSupported!");

            {//StylusTouchSupported
                data.StylusTouchSupported = !data.StylusTouchSupported;
                var observer = data.GetValuesEnumerable()
                               .First(_t => _t.Key == TouchFrameInputData.KeyStylusTouchSupported)
                               .Value;
                Assert.AreEqual(data.StylusTouchSupported, observer.RawValue);
                Assert.IsTrue(observer.DidUpdated);
            }
            Debug.Log($"Success to StylusTouchSupported!");

            {//SimulateMouseWithTouches
                data.SimulateMouseWithTouches = !data.SimulateMouseWithTouches;
                var observer = data.GetValuesEnumerable()
                               .First(_t => _t.Key == TouchFrameInputData.KeySimulateMouseWithTouches)
                               .Value;
                Assert.AreEqual(data.SimulateMouseWithTouches, observer.RawValue);
                Assert.IsTrue(observer.DidUpdated);
            }
            Debug.Log($"Success to SimulateMouseWithTouches!");

            {//MultiTouchEnabled
                data.MultiTouchEnabled = !data.MultiTouchEnabled;
                var observer = data.GetValuesEnumerable()
                               .First(_t => _t.Key == TouchFrameInputData.KeyMultiTouchEnabled)
                               .Value;
                Assert.AreEqual(data.MultiTouchEnabled, observer.RawValue);
                Assert.IsTrue(observer.DidUpdated);
            }
            Debug.Log($"Success to MultiTouchEnabled!");

            for (int i = 0; i < TouchFrameInputData.LIMIT_TOUCH_COUNT; ++i)
            {
                var errorMessage = $"Failed Set/GetTouch()... index={i}";
                data.SetTouch(i, new Touch {
                    fingerId = i + 10
                });
                var observer = data.GetValuesEnumerable()
                               .First(_t => _t.Key == i.ToString())
                               .Value;
                Assert.AreEqual(data.GetTouch(i), observer.RawValue, errorMessage);
                Assert.IsTrue(observer.DidUpdated, errorMessage);
                Debug.Log($"Success to Touch({i})!");
            }
        }