2 using System.Threading.Tasks;
5 namespace Tizen.Sensor.Tests
8 [Description("Testing Tizen.Sensor.MagnetometerRotationVectorSensorDataUpdatedEventArgs class")]
9 public static class MagnetometerRotationVectorSensorDataUpdatedEventArgsTests
11 private static bool _support = false;
14 public static void Init()
16 _support = TSSensorHelper.CheckCapability("http://tizen.org/feature/sensor.geomagnetic_rotation_vector");
21 [Description("Check accuracy when MagnetometerRotationVectorSensorDataUpdated event is triggered")]
22 [Property("SPEC", "Tizen.Sensor.MagnetometerRotationVectorSensorDataUpdatedEventArgs.Accuracy A")]
23 [Property("SPEC_URL", "-")]
24 [Property("CRITERIA", "PRO")]
25 [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
26 [Precondition(1, "MagnetometerRotationVectorSensor sensor should be available")]
27 [Step(1, "Tap the Run button")]
28 [Step(2, "MagnetometerRotationVectorSensor sensor data update event: Rotate the test device")]
29 public static async Task Accuracy_PROPERTY_READ_ONLY()
33 var sensor = new MagnetometerRotationVectorSensor(0);
34 sensor.Interval = 100;
35 SensorDataAccuracy getValue = sensor.Accuracy;
37 EventHandler<MagnetometerRotationVectorSensorDataUpdatedEventArgs> handler = null;
38 handler = (sender, e) =>
41 Assert.IsInstanceOf<SensorDataAccuracy>(e.Accuracy, "Accuracy value should be of type SensorDataAccuracy");
42 Assert.IsTrue(e.Accuracy != getValue, "Accuracy value should be changed.");
46 sensor.DataUpdated += handler;
49 await ManualTest.WaitForConfirm();
52 sensor.DataUpdated -= handler;
55 catch (NotSupportedException)
57 Assert.IsTrue(_support == false, "Invalid NotSupportedException");
58 TSSensorHelper.DisplayLabel("MagnetometerRotationVectorSensor");
59 await ManualTest.WaitForConfirm();
63 Assert.True(false, "should not throw exception(" + e.Message + ")");
69 [Description("Check w when MagnetometerRotationVectorSensorDataUpdated event is triggered")]
70 [Property("SPEC", "Tizen.Sensor.MagnetometerRotationVectorSensorDataUpdatedEventArgs.W A")]
71 [Property("SPEC_URL", "-")]
72 [Property("CRITERIA", "PRO")]
73 [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
74 [Precondition(1, "MagnetometerRotationVectorSensor sensor should be available")]
75 [Step(1, "Tap the Run button")]
76 [Step(2, "MagnetometerRotationVectorSensor sensor data update event: Rotate the test device")]
77 public static async Task W_PROPERTY_READ_ONLY()
81 var sensor = new MagnetometerRotationVectorSensor(0);
82 sensor.Interval = 100;
83 float getValue = sensor.W;
85 EventHandler<MagnetometerRotationVectorSensorDataUpdatedEventArgs> handler = null;
86 handler = (sender, e) =>
89 Assert.IsInstanceOf<float>(e.W, "W value should be of type float");
90 Assert.IsTrue(e.W != getValue, "W value should be changed.");
94 sensor.DataUpdated += handler;
97 await ManualTest.WaitForConfirm();
100 sensor.DataUpdated -= handler;
103 catch (NotSupportedException)
105 Assert.IsTrue(_support == false, "Invalid NotSupportedException");
106 TSSensorHelper.DisplayLabel("MagnetometerRotationVectorSensor");
107 await ManualTest.WaitForConfirm();
111 Assert.True(false, "should not throw exception(" + e.Message + ")");
117 [Description("Check x when MagnetometerRotationVectorSensorDataUpdated event is triggered")]
118 [Property("SPEC", "Tizen.Sensor.MagnetometerRotationVectorSensorDataUpdatedEventArgs.X A")]
119 [Property("SPEC_URL", "-")]
120 [Property("CRITERIA", "PRO")]
121 [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
122 [Precondition(1, "MagnetometerRotationVectorSensor sensor should be available")]
123 [Step(1, "Tap the Run button")]
124 [Step(2, "MagnetometerRotationVectorSensor sensor data update event: Rotate the test device")]
125 public static async Task X_PROPERTY_READ_ONLY()
129 var sensor = new MagnetometerRotationVectorSensor(0);
130 sensor.Interval = 100;
131 float getValue = sensor.X;
133 EventHandler<MagnetometerRotationVectorSensorDataUpdatedEventArgs> handler = null;
134 handler = (sender, e) =>
137 Assert.IsInstanceOf<float>(e.X, "X value should be of type float");
138 Assert.IsTrue(e.X != getValue, "X value should be changed.");
139 ManualTest.Confirm();
142 sensor.DataUpdated += handler;
145 await ManualTest.WaitForConfirm();
148 sensor.DataUpdated -= handler;
151 catch (NotSupportedException)
153 Assert.IsTrue(_support == false, "Invalid NotSupportedException");
154 TSSensorHelper.DisplayLabel("MagnetometerRotationVectorSensor");
155 await ManualTest.WaitForConfirm();
159 Assert.True(false, "should not throw exception(" + e.Message + ")");
165 [Description("Check y when MagnetometerRotationVectorSensorDataUpdated event is triggered")]
166 [Property("SPEC", "Tizen.Sensor.MagnetometerRotationVectorSensorDataUpdatedEventArgs.Y A")]
167 [Property("SPEC_URL", "-")]
168 [Property("CRITERIA", "PRO")]
169 [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
170 [Precondition(1, "MagnetometerRotationVectorSensor sensor should be available")]
171 [Step(1, "Tap the Run button")]
172 [Step(2, "MagnetometerRotationVectorSensor sensor data update event: Rotate the test device")]
173 public static async Task Y_PROPERTY_READ_ONLY()
177 var sensor = new MagnetometerRotationVectorSensor(0);
178 sensor.Interval = 100;
179 float getValue = sensor.Y;
181 EventHandler<MagnetometerRotationVectorSensorDataUpdatedEventArgs> handler = null;
182 handler = (sender, e) =>
185 Assert.IsInstanceOf<float>(e.Y, "Y value should be of type float");
186 Assert.IsTrue(e.Y != getValue, "Y value should be changed.");
187 ManualTest.Confirm();
190 sensor.DataUpdated += handler;
193 await ManualTest.WaitForConfirm();
196 sensor.DataUpdated -= handler;
199 catch (NotSupportedException)
201 Assert.IsTrue(_support == false, "Invalid NotSupportedException");
202 TSSensorHelper.DisplayLabel("MagnetometerRotationVectorSensor");
203 await ManualTest.WaitForConfirm();
207 Assert.True(false, "should not throw exception(" + e.Message + ")");
213 [Description("Check z when MagnetometerRotationVectorSensorDataUpdated event is triggered")]
214 [Property("SPEC", "Tizen.Sensor.MagnetometerRotationVectorSensorDataUpdatedEventArgs.Z A")]
215 [Property("SPEC_URL", "-")]
216 [Property("CRITERIA", "PRO")]
217 [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
218 [Precondition(1, "MagnetometerRotationVectorSensor sensor should be available")]
219 [Step(1, "Tap the Run button")]
220 [Step(2, "MagnetometerRotationVectorSensor sensor data update event: Rotate the test device")]
221 public static async Task Z_PROPERTY_READ_ONLY()
225 var sensor = new MagnetometerRotationVectorSensor(0);
226 sensor.Interval = 100;
227 float getValue = sensor.Z;
229 EventHandler<MagnetometerRotationVectorSensorDataUpdatedEventArgs> handler = null;
230 handler = (sender, e) =>
233 Assert.IsInstanceOf<float>(e.Z, "Z value should be of type float");
234 Assert.IsTrue(e.Z != getValue, "Z value should be changed.");
235 ManualTest.Confirm();
238 sensor.DataUpdated += handler;
241 await ManualTest.WaitForConfirm();
244 sensor.DataUpdated -= handler;
247 catch (NotSupportedException)
249 Assert.IsTrue(_support == false, "Invalid NotSupportedException");
250 TSSensorHelper.DisplayLabel("MagnetometerRotationVectorSensor");
251 await ManualTest.WaitForConfirm();
255 Assert.True(false, "should not throw exception(" + e.Message + ")");