Tanoda
DeviceTests.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9#if !UNITY_EDITOR_LINUX
10
11using NUnit.Framework;
12using System;
13
14namespace Leap.LeapCSharp.Tests {
15 [TestFixture()]
16 public class DeviceTests {
17 Controller controller;
18
19 [OneTimeSetUp]
20 public void Init() {
21 controller = new Controller();
22 System.Threading.Thread.Sleep(500);
23 }
24
25 [Test]
26 public void DeviceIsConnected() {
27 Assert.True(controller.IsConnected,
28 "A Leap device must be connected to successfully test LeapCSharp.");
29 }
30
31 [Test()]
32 public void Device_operator_equals() {
33 Device thisDevice = new Device();
34 Device thatDevice = new Device();
35 // !!!Device_operator_equals
36 Boolean isEqual = thisDevice == thatDevice;
37 // !!!END
38 Assert.False(isEqual);
39
40 }
41
42 [Test()]
44 // !!!DeviceList_operator_index
45 DeviceList allDevices = controller.Devices;
46 for (int index = 0; index < allDevices.Count; index++) {
47 Console.WriteLine(allDevices[index]);
48 }
49 // !!!END
50
51 }
52
53 [Test()]
54 public void DeviceList_isEmpty() {
55 // !!!DeviceList_isEmpty
56 if (!controller.Devices.IsEmpty) {
57 Device leapDevice = controller.Devices[0];
58 }
59 // !!!END
60 }
61 }
62}
63
64#endif
The Controller class is your main interface to the Leap Motion Controller.
DeviceList Devices
The list of currently attached and recognized Leap Motion controller devices.
bool IsConnected
Reports whether this Controller is connected to the Leap Motion service and the Leap Motion hardware ...
The Device class represents a physically connected device.
Definition: Device.cs:29
The DeviceList class represents a list of Device objects.
Definition: DeviceList.cs:20
bool IsEmpty
Reports whether the list is empty.
Definition: DeviceList.cs:75