* Add testcases for new type sensors (HeartRateMonitorBatch, HeartRateMonitorLEDGreenBatch).
This patch includes a new sensor data type,batch data type.
The batch data type is a series of sensor data.
HeartRateMonitorBatch : HRM data series which collected over a period of time.
HeartRateMonitorLEDGreenBatch : HRM Green sensor data series which collected over a period of time.
Change-Id: I90d1c7b4ba572d152c7f0d6e4f0f17e71aa1680c
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorBatch class")]
+ public class HeartRateMonitorBatchTests
+ {
+ private static bool _support = false;
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ _support = TSSensorHelper.CheckCapability("http://tizen.org/feature/sensor.heart_rate_monitor.batch");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check HeartRateMonitorBatch DataUpdated event")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.DataUpdated E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "HeartRateMonitorBatch sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "HeartRateMonitorBatch event: Put your device on your wrist and wait a moment.")]
+ public async Task DataUpdated_CHECK_EVENT()
+ {
+ try
+ {
+ /* TEST CODE */
+ EventHandler<HeartRateMonitorBatchDataUpdatedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+ Assert.True(true);
+ ManualTest.Confirm();
+ };
+
+ var sensor = new HeartRateMonitorBatch(0);
+ sensor.DataUpdated += handler;
+ sensor.Start();
+ sensor.Interval = 100;
+ await ManualTest.WaitForConfirm();
+ sensor.Stop();
+ sensor.DataUpdated -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("HeartRateMonitorBatch");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check HeartRateMonitorBatch AccuracyChanged event")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.AccuracyChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "HeartRateMonitorBatch sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Rotate the test device")]
+ public async Task AccuracyChanged_CHECK_EVENT()
+ {
+ try
+ {
+ /* TEST CODE */
+ EventHandler<SensorAccuracyChangedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+
+ Assert.True(true);
+ ManualTest.Confirm();
+ };
+
+ var sensor = new HeartRateMonitorBatch();
+ sensor.AccuracyChanged += handler;
+ sensor.Start();
+ sensor.Interval = 100;
+ await ManualTest.WaitForConfirm();
+ sensor.Stop();
+ sensor.AccuracyChanged -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("HeartRateMonitorBatch");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorBatchDataUpdatedEventArgs class")]
+ public class HeartRateMonitorBatchDataUpdatedEventArgsTests
+ {
+ private static bool _support = false;
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ _support = TSSensorHelper.CheckCapability("http://tizen.org/feature/sensor.heart_rate_monitor.batch");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check heart rate when HeartRateMonitorBatch DataUpdated event is triggered")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatchDataUpdatedEventArgs.Data A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "HeartRateMonitorBatch sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Put a test device on your wrist and wait a moment.")]
+ public async Task Data_PROPERTY_READ_ONLY()
+ {
+ try
+ {
+ var sensor = new HeartRateMonitorBatch();
+ sensor.Interval = 100;
+ IReadOnlyList<HeartRateMonitorBatchData> getValue = null;
+
+ EventHandler<HeartRateMonitorBatchDataUpdatedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+ /* TESTCODE */
+ Assert.IsInstanceOf<IReadOnlyList<HeartRateMonitorBatchData>>(sensor.Data, "Data value should be IReadOnlyList of HeartRateMonitorBatchData");
+ Assert.IsTrue(sensor.Data != getValue, "HeartRateMonitorBatch value should be changed.");
+ ManualTest.Confirm();
+ };
+
+ sensor.DataUpdated += handler;
+ sensor.Start();
+
+ getValue = sensor.Data;
+ await ManualTest.WaitForConfirm();
+
+ sensor.Stop();
+ sensor.DataUpdated -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("HeartRateMonitorBatch");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+ }
+}
+
+
+
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorLEDGreenBatch class")]
+ public class HeartRateMonitorLEDGreenBatchTests
+ {
+ private static bool _support = false;
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ _support = TSSensorHelper.CheckCapability("http://tizen.org/feature/sensor.heart_rate_monitor.led_green.batch");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check HeartRateMonitorLEDGreenBatch DataUpdated event")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.DataUpdated E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "HeartRateMonitorLEDGreenBatch sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Heart rate monitor event: Put your device on your wrist and wait a moment.")]
+ public async Task DataUpdated_CHECK_EVENT()
+ {
+ try
+ {
+ /* TEST CODE */
+ EventHandler<HeartRateMonitorLEDGreenBatchDataUpdatedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+ Assert.True(true);
+ ManualTest.Confirm();
+ };
+
+ var sensor = new HeartRateMonitorLEDGreenBatch(0);
+ sensor.DataUpdated += handler;
+ sensor.Start();
+ sensor.Interval = 100;
+ await ManualTest.WaitForConfirm();
+ sensor.Stop();
+ sensor.DataUpdated -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("HeartRateMonitorLEDGreenBatch");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check HeartRateMonitorLEDGreenBatch AccuracyChanged event")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.AccuracyChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "HeartRateMonitorLEDGreenBatch sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Rotate the test device")]
+ public async Task AccuracyChanged_CHECK_EVENT()
+ {
+ try
+ {
+ /* TEST CODE */
+ EventHandler<SensorAccuracyChangedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+
+ Assert.True(true);
+ ManualTest.Confirm();
+ };
+
+ var sensor = new HeartRateMonitorLEDGreenBatch();
+ sensor.AccuracyChanged += handler;
+ sensor.Start();
+ sensor.Interval = 100;
+ await ManualTest.WaitForConfirm();
+ sensor.Stop();
+ sensor.AccuracyChanged -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("HeartRateMonitorLEDGreenBatch");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorLEDGreenBatchDataUpdatedEventArgs class")]
+ public class HeartRateMonitorLEDGreenBatchDataUpdatedEventArgsTests
+ {
+ private static bool _support = false;
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ _support = TSSensorHelper.CheckCapability("http://tizen.org/feature/sensor.heart_rate_monitor.led_green.batch");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check Data value when HeartRateMonitorLEDGreenBatch DataUpdated event is triggered")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchDataUpdatedEventArgs.Data A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "HeartRateMonitorLEDGreenBatch sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Put a test device on your wrist and wait a moment.")]
+ public async Task Data_PROPERTY_READ_ONLY()
+ {
+ try
+ {
+ var sensor = new HeartRateMonitorLEDGreenBatch(0);
+ sensor.Interval = 100;
+ IReadOnlyList<HeartRateMonitorLEDGreenBatchData> getValue = null;
+
+ EventHandler<HeartRateMonitorLEDGreenBatchDataUpdatedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+ /* TESTCODE */
+ Assert.IsInstanceOf<IReadOnlyList<HeartRateMonitorLEDGreenBatchData>>(e.Data, "Data value should be IReadOnlyList of HeartRateMonitorLEDGreenBatchData");
+ Assert.IsTrue(e.Data != getValue, "Data value should be changed.");
+ ManualTest.Confirm();
+ };
+
+ sensor.DataUpdated += handler;
+ sensor.Start();
+
+ getValue = sensor.Data;
+ await ManualTest.WaitForConfirm();
+
+ sensor.Stop();
+ sensor.DataUpdated -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("HeartRateMonitor");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+ }
+}
+
+
+
Assert.True(false, "should not throw exception(" + e.Message + ")");
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Check timestamp when sensor event is triggered")]
+ [Property("SPEC", "Tizen.Sensor.SensorAccuracyChangedEventArgs.Timestamp A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Precondition(1, "RotationVectorSensor sensor should be available")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Accuracy changed event: Its difficult to reproduce this event. Accuracy may change when make big 8-like gestures with the device OR the device is exposed to strong electromagnetic fields/ferrous metal objects.")]
+ public async Task Timestamp_PROPERTY_READ_ONLY()
+ {
+ try
+ {
+ /* TESTCODE */
+ var sensor = new RotationVectorSensor(0);
+ sensor.Interval = 100;
+ ulong getValue = sensor.Timestamp;
+
+ EventHandler<SensorAccuracyChangedEventArgs> handler = null;
+ handler = (sender, e) =>
+ {
+ Assert.IsInstanceOf<ulong>(e.Timestamp, "Timestamp value should be of type ulong");
+ Assert.IsTrue(e.Timestamp != getValue, "Timestamp value should be changed.");
+ ManualTest.Confirm();
+ };
+ sensor.AccuracyChanged += handler;
+
+ sensor.Start();
+ await ManualTest.WaitForConfirm();
+ sensor.Stop();
+ sensor.AccuracyChanged -= handler;
+ sensor.Dispose();
+ }
+ catch (NotSupportedException)
+ {
+ Assert.IsTrue(_support == false, "Invalid NotSupportedException");
+ TSSensorHelper.DisplayLabel("RotationVectorSensor");
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+
}
}
--- /dev/null
+using System;
+using Tizen.System;
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.BatchData class")]
+ public class BatchDataTests
+ {
+ public class MyBatchData : BatchData
+ {
+ public MyBatchData(ulong timestamp, SensorDataAccuracy accuracy) : base(timestamp, accuracy) { }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test BatchData object construction")]
+ [Property("SPEC", "Tizen.Sensor.BatchData.BatchData C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void BatchData_INIT()
+ {
+ try
+ {
+ /* TESTCODE */
+ var obj = new MyBatchData(0, SensorDataAccuracy.Good);
+ Assert.IsNotNull(obj, "Object should not be null after construction");
+ Assert.IsInstanceOf<MyBatchData>(obj, "Object's type should be MyBatchData.");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of BatchData.Timestamp")]
+ [Property("SPEC", "Tizen.Sensor.BatchData.Timestamp A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Timestamp_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new MyBatchData(0, SensorDataAccuracy.Good);
+ Assert.IsInstanceOf<ulong>(obj.Timestamp, "Object's Timestamp value should be ulong.");
+ Assert.True((obj.Timestamp == 0), "Timestamp value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of BatchData.Accuracy")]
+ [Property("SPEC", "Tizen.Sensor.BatchData.Accuracy A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Accuracy_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new MyBatchData(0, SensorDataAccuracy.Good);
+ Assert.IsInstanceOf<SensorDataAccuracy>(obj.Accuracy, "Object's Accuracy value should be SensorDataAccuracy.");
+ Assert.True((obj.Accuracy == SensorDataAccuracy.Good), "Accuracy value returned is different from initial value");
+ }
+ }
+}
+
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.BatchSensor class")]
+ public class BatchSensorTests
+ {
+ private static List<Sensor> batchSensors = new List<Sensor>();
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ if (HeartRateMonitorBatch.IsSupported)
+ batchSensors.Add(new HeartRateMonitorBatch(0));
+ if (HeartRateMonitorLEDGreenBatch.IsSupported)
+ batchSensors.Add(new HeartRateMonitorLEDGreenBatch(0));
+ }
+
+ [OneTimeTearDown]
+ public void Destroy()
+ {
+ foreach (var item in batchSensors)
+ {
+ if (item != null)
+ item.Dispose();
+ }
+ batchSensors.Clear();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the default value of BatchSensor<TData>.Data")]
+ [Property("SPEC", "Tizen.Sensor.BatchSensor<TData>.Data A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Data_PROPERTY_READ_DEFAULT()
+ {
+ /* TESTCODE */
+ foreach (var item in batchSensors)
+ {
+ var result = item.GetType().GetProperty("Data").GetValue(item);
+ Assert.IsNotNull(result, "Default Data value of BatchSensor should not be null.");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test stability of BatchSensor<TData>.UpdateBatchData")]
+ [Property("SPEC", "Tizen.Sensor.BatchSensor<TData>.UpdateBatchData M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void UpdateBatchData_STATUS()
+ {
+ try
+ {
+ /* TESTCODE */
+ foreach (var item in batchSensors)
+ {
+ MethodInfo methodInfo = item.GetType().GetMethod("UpdateBatchData", BindingFlags.NonPublic | BindingFlags.Instance);
+ IntPtr param1 = (IntPtr)null;
+ uint param2 = 0;
+ methodInfo.Invoke(item, new object[] { param1, param2 });
+ }
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ }
+}
--- /dev/null
+using System;
+using Tizen.System;
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorBatch class")]
+ public class HeartRateMonitorBatchTests
+ {
+ private static string HeartRateMonitorBatchKey = "http://tizen.org/feature/sensor.heart_rate_monitor.batch";
+ private static bool support = false;
+
+ private static bool CheckCapability()
+ {
+ bool ret = false;
+ if (Information.TryGetValue<bool>(HeartRateMonitorBatchKey, out ret))
+ return ret;
+
+ return false;
+ }
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ support = CheckCapability();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test HeartRateMonitorBatch object construction")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.HeartRateMonitorBatch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Property("COVPARAM", "")]
+ public void HeartRateMonitorBatch_INIT()
+ {
+ /*
+ * PRECONDITION
+ * 1. HeartRateMonitorBatch should be available
+ */
+ try
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorBatch();
+ Assert.IsNotNull(obj, "Object should not be null after construction");
+ Assert.IsInstanceOf<HeartRateMonitorBatch>(obj, "Object's type should be HeartRateMonitorBatch.");
+
+ /* POST CONDITION */
+ obj.Dispose();
+ }
+ catch (Exception e)
+ {
+ if (e is NotSupportedException)
+ {
+ Assert.IsTrue(support == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check HeartRateMonitorBatch constructor for exception")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.HeartRateMonitorBatch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTX")]
+ [Property("COVPARAM", "")]
+ public void HeartRateMonitorBatch_INIT_NOT_SUPPORTED_EXCEPTION()
+ {
+ if (!support)
+ {
+ Assert.Throws<NotSupportedException>(() => { var obj = new HeartRateMonitorBatch(); });
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test not supported exception");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorBatch.IsSupported")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.IsSupported A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void IsSupported_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ bool ret = HeartRateMonitorBatch.IsSupported;
+ Assert.IsNotNull(ret, "IsSupported value returned is null");
+ Assert.True((ret == support), "IsSupported value returned is different from capability");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorBatch.Accuracy")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.Accuracy A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Accuracy_PROPERTY_READ_ONLY()
+ {
+ /*
+ * PRECONDITION
+ * 1. HeartRateMonitorBatch Sensor should be available
+ * 2. Sensor PausePolicy set All.
+ */
+ try
+ {
+ var sensor = new HeartRateMonitorBatch();
+ sensor.PausePolicy = SensorPausePolicy.All;
+
+ /* TESTCODE */
+ object ret = sensor.Accuracy;
+ Assert.IsNotNull(ret, "HeartRateMonitorBatch.Accuracy is null");
+ Assert.IsTrue(sensor.Accuracy >= SensorDataAccuracy.Undefined && sensor.Accuracy <= SensorDataAccuracy.VeryGood, "Not in range");
+ Assert.True((ret is SensorDataAccuracy), "Accuracy value returned is not of type SensorDataAccuracy");
+
+ /* POST CONDITION */
+ sensor.PausePolicy = SensorPausePolicy.None;
+ sensor.Dispose();
+ }
+ catch (Exception e)
+ {
+ if (!support)
+ Assert.IsInstanceOf<NotSupportedException>(e, "NotSupportedException should be thrown for not supported sensor");
+ else
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorBatch.Count")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatch.Count A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Count_PROPERTY_READ_ONLY()
+ {
+ try
+ {
+ /* TESTCODE */
+ object ret = HeartRateMonitorBatch.Count;
+ Assert.IsNotNull(ret, "Count value returned should not be null");
+ Assert.True((ret is int), "Count value returned is not of type int");
+ Assert.Greater((int)ret, -1, "Count of HeartRateMonitorBatch cant be negative");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+ }
+}
+
--- /dev/null
+using System;
+using Tizen.System;
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorBatchData class")]
+ public class HeartRateMonitorBatchDataTests
+ {
+
+ [Test]
+ [Category("P1")]
+ [Description("Test HeartRateMonitorBatchData object construction")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatchData.HeartRateMonitorBatchData C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void HeartRateMonitorBatchData_INIT()
+ {
+ try
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorBatchData(0, SensorDataAccuracy.Good, HeartRateMonitorBatchState.SENSOR_HRM_BATCH_STATE_NONE, 0, 0);
+ Assert.IsNotNull(obj, "Object should not be null after construction");
+ Assert.IsInstanceOf<HeartRateMonitorBatchData>(obj, "Object's type should be HeartRateMonitorBatchData.");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorBatchData.State")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatchData.State A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void State_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorBatchData(0, SensorDataAccuracy.Good, HeartRateMonitorBatchState.SENSOR_HRM_BATCH_STATE_NONE, 0, 0);
+ Assert.IsInstanceOf<HeartRateMonitorBatchState>(obj.State, "Object's State value should be HeartRateMonitorBatchState.");
+ Assert.True((obj.State == HeartRateMonitorBatchState.SENSOR_HRM_BATCH_STATE_NONE), "State value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorBatchData.HeartRate")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatchData.HeartRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void HeartRate_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorBatchData(0, SensorDataAccuracy.Good, HeartRateMonitorBatchState.SENSOR_HRM_BATCH_STATE_NONE, 0, 0);
+ Assert.IsInstanceOf<int>(obj.HeartRate, "Object's HeartRate value should be int.");
+ Assert.True((obj.HeartRate == 0), "HeartRate value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorBatchData.RRInterval")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorBatchData.RRInterval A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void RRInterval_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorBatchData(0, SensorDataAccuracy.Good, HeartRateMonitorBatchState.SENSOR_HRM_BATCH_STATE_NONE, 0, 0);
+ Assert.IsInstanceOf<int>(obj.RRInterval, "Object's RRInterval value should be int.");
+ Assert.True((obj.RRInterval == 0), "RRInterval value returned is different from initial value");
+ }
+ }
+}
+
--- /dev/null
+using System;
+using Tizen.System;
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorLEDGreenBatch class")]
+ public class HeartRateMonitorLEDGreenBatchTests
+ {
+ private static string HeartRateMonitorLEDGreenBatchKey = "http://tizen.org/feature/sensor.heart_rate_monitor.led_green.batch";
+ private static bool support = false;
+
+ private static bool CheckCapability()
+ {
+ bool ret = false;
+ if (Information.TryGetValue<bool>(HeartRateMonitorLEDGreenBatchKey, out ret))
+ return ret;
+
+ return false;
+ }
+
+ [OneTimeSetUp]
+ public void Init()
+ {
+ support = CheckCapability();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test HeartRateMonitorLEDGreenBatch object construction")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.HeartRateMonitorLEDGreenBatch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Property("COVPARAM", "")]
+ public void HeartRateMonitorLEDGreenBatch_INIT()
+ {
+ /*
+ * PRECONDITION
+ * 1. HeartRateMonitorLEDGreenBatch should be available
+ */
+ try
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatch();
+ Assert.IsNotNull(obj, "Object should not be null after construction");
+ Assert.IsInstanceOf<HeartRateMonitorLEDGreenBatch>(obj, "Object's type should be HeartRateMonitorLEDGreenBatch.");
+
+ /* POST CONDITION */
+ obj.Dispose();
+ }
+ catch (Exception e)
+ {
+ if (e is NotSupportedException)
+ {
+ Assert.IsTrue(support == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check HeartRateMonitorLEDGreenBatch constructor for exception")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.HeartRateMonitorLEDGreenBatch C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "")]
+ public void HeartRateMonitorLEDGreenBatch_INIT_TEST_NOT_SUPPORT()
+ {
+ if (!support)
+ {
+ Assert.Throws<NotSupportedException>(() => { var obj = new HeartRateMonitorLEDGreenBatch(); });
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test not supported exception");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatch.IsSupported")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.IsSupported A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void IsSupported_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ bool ret = HeartRateMonitorLEDGreenBatch.IsSupported;
+ Assert.IsNotNull(ret, "IsSupported value returned is null");
+ Assert.True((ret == support), "IsSupported value returned is different from capability");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatch.Accuracy")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.Accuracy A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Accuracy_PROPERTY_READ_ONLY()
+ {
+ /*
+ * PRECONDITION
+ * 1. HeartRateMonitorBatch Sensor should be available
+ * 2. Sensor PausePolicy set All.
+ */
+ try
+ {
+ var sensor = new HeartRateMonitorLEDGreenBatch();
+ sensor.PausePolicy = SensorPausePolicy.All;
+
+ /* TESTCODE */
+ object ret = sensor.Accuracy;
+ Assert.IsNotNull(ret, "HeartRateMonitorLEDGreenBatch.Accuracy is null");
+ Assert.IsTrue(sensor.Accuracy >= SensorDataAccuracy.Undefined && sensor.Accuracy <= SensorDataAccuracy.VeryGood, "Not in range");
+ Assert.True((ret is SensorDataAccuracy), "Accuracy value returned is not of type SensorDataAccuracy");
+
+ /* POST CONDITION */
+ sensor.PausePolicy = SensorPausePolicy.None;
+ sensor.Dispose();
+ }
+ catch (Exception e)
+ {
+ if (!support)
+ Assert.IsInstanceOf<NotSupportedException>(e, "NotSupportedException should be thrown for not supported sensor");
+ else
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatch.Count")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatch.Count A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Count_PROPERTY_READ_ONLY()
+ {
+ try
+ {
+ /* TESTCODE */
+ object ret = HeartRateMonitorLEDGreenBatch.Count;
+ Assert.IsNotNull(ret, "Count value returned should not be null");
+ Assert.True((ret is int), "Count value returned is not of type int");
+ Assert.Greater((int)ret, -1, "Count of HeartRateMonitorLEDGreenBatch cant be negative");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+ }
+}
+
--- /dev/null
+using System;
+using Tizen.System;
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace Tizen.Sensor.Tests
+{
+ [TestFixture]
+ [Description("Testing Tizen.Sensor.HeartRateMonitorLEDGreenBatchData class")]
+ public class HeartRateMonitorLEDGreenBatchDataTests
+ {
+ [Test]
+ [Category("P1")]
+ [Description("Test HeartRateMonitorLEDGreenBatchData object construction")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchData.HeartRateMonitorLEDGreenBatchData C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ [Property("COVPARAM", "")]
+ public void HeartRateMonitorLEDGreenBatchData_INIT()
+ {
+ try
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatchData(0, SensorDataAccuracy.Good, 0, 0, 0, 0, 0);
+ Assert.IsNotNull(obj, "Object should not be null after construction");
+ Assert.IsInstanceOf<HeartRateMonitorLEDGreenBatchData>(obj, "Object's type should be HeartRateMonitorLEDGreenBatchData.");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, "should not throw exception(" + e.Message + ")");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatchData.Green")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchData.Green A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Green_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatchData(0, SensorDataAccuracy.Good, 0, 0, 0, 0, 0);
+ Assert.IsInstanceOf<uint>(obj.Green, "Object's Green value should be uint.");
+ Assert.True((obj.Green == 0), "Green value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatchData.AccelerationX")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchData.AccelerationX A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void AccelerationX_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatchData(0, SensorDataAccuracy.Good, 0, 0, 0, 0, 0);
+ Assert.IsInstanceOf<int>(obj.AccelerationX, "Object's AccelerationX value should be int.");
+ Assert.True((obj.AccelerationX == 0), "AccelerationX value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatchData.AccelerationY")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchData.AccelerationY A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void AccelerationY_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatchData(0, SensorDataAccuracy.Good, 0, 0, 0, 0, 0);
+ Assert.IsInstanceOf<int>(obj.AccelerationY, "Object's AccelerationY value should be int.");
+ Assert.True((obj.AccelerationY == 0), "AccelerationY value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatchData.AccelerationZ")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchData.AccelerationZ A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void AccelerationZ_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatchData(0, SensorDataAccuracy.Good, 0, 0, 0, 0, 0);
+ Assert.IsInstanceOf<int>(obj.AccelerationZ, "Object's AccelerationZ value should be int.");
+ Assert.True((obj.AccelerationZ == 0), "AccelerationZ value returned is different from initial value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check the return type and value of HeartRateMonitorLEDGreenBatchData.Index")]
+ [Property("SPEC", "Tizen.Sensor.HeartRateMonitorLEDGreenBatchData.Index A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Index_PROPERTY_READ_ONLY()
+ {
+ /* TESTCODE */
+ var obj = new HeartRateMonitorLEDGreenBatchData(0, SensorDataAccuracy.Good, 0, 0, 0, 0, 0);
+ Assert.IsInstanceOf<uint>(obj.Index, "Object's RRInterval value should be uint.");
+ Assert.True((obj.Index == 0), "RRInterval value returned is different from initial value");
+ }
+
+ }
+}
+
sensors.Add(new LightSensor(0));
if (HeartRateMonitor.IsSupported)
sensors.Add(new HeartRateMonitor(0));
+ if (HeartRateMonitorBatch.IsSupported)
+ sensors.Add(new HeartRateMonitorBatch(0));
+ if (HeartRateMonitorLEDGreenBatch.IsSupported)
+ sensors.Add(new HeartRateMonitorLEDGreenBatch(0));
if (Gyroscope.IsSupported)
sensors.Add(new Gyroscope(0));
if (UncalibratedGyroscope.IsSupported)
[Test]
[Category("P1")]
+ [Description("Check the return type and value of Sensor.Timestamp")]
+ [Property("SPEC", "Tizen.Sensor.Sensor.Timestamp A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Muhong Byun, mh.byun@samsung.com")]
+ public void Timestamp_PROPERTY_READ_WRITE()
+ {
+ /* TESTCODE */
+ foreach (var item in sensors)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "############### Testing [" + item.GetType() + "] object");
+ item.Timestamp = 10;
+ Assert.IsTrue(item.Timestamp == 10, "Failed to read/write value");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Check the return type and value of Sensor.IsSensing")]
[Property("SPEC", "Tizen.Sensor.Sensor.IsSensing A")]
[Property("SPEC_URL", "-")]