1 package org.openkinect.freenect;
3 import static org.hamcrest.Matchers.*;
4 import static org.junit.Assert.*;
5 import static org.junit.Assume.*;
7 import java.nio.ByteBuffer;
8 import java.util.ArrayList;
11 import org.hamcrest.collection.IsEmptyCollection;
12 import org.junit.AfterClass;
13 import org.junit.BeforeClass;
14 import org.junit.Test;
29 System.err.println(
"WARNING: No kinects detected, hardware tests will be implicitly passed.");
44 if (
device.getTiltAngle() >= (degrees - 2) &&
device.getTiltAngle() <= (degrees + 2)) {
47 assertThat(
device.setTiltAngle(degrees), is(0));
60 while (
device.getTiltAngle() < -32) {
66 @Test(timeout = 10000)
68 assumeThat(dev, is(not(nullValue())));
88 assumeThat(dev, is(not(nullValue())));
91 final List<String> messages =
new ArrayList<String>();
100 public void onFrameReceived(
FrameMode mode, ByteBuffer
frame,
int timestamp) {
107 assertThat(messages, is(not(IsEmptyCollection.<String>empty())));
110 @Test(timeout = 2000)
112 assumeThat(dev, is(not(nullValue())));
114 final Object lock =
new Object();
115 final long start = System.nanoTime();
120 public void onFrameReceived(
FrameMode mode, ByteBuffer
frame,
int timestamp) {
122 if (frameCount == 30) {
123 synchronized (lock) {
125 System.out.format(
"Got %d depth frames in %4.2fs%n", frameCount,
126 (((
double) System.nanoTime() - start) / 1000000000));
131 synchronized (lock) {
136 @Test(timeout = 2000)
138 assumeThat(dev, is(not(nullValue())));
140 final Object lock =
new Object();
141 final long start = System.nanoTime();
146 public void onFrameReceived(
FrameMode mode, ByteBuffer
frame,
int timestamp) {
148 if (frameCount == 30) {
149 synchronized (lock) {
151 System.out.format(
"Got %d video frames in %4.2fs%n", frameCount,
152 (((
double) System.nanoTime() - start) / 1000000000));
157 synchronized (lock) {
int startDepth(DepthHandler handler)
Device openDevice(int index)
void setLogLevel(LogLevel level)
void setLogHandler(LogHandler handler)
void moveAndWait(Device device, int degrees)
MyFreenectDevice * device
static void shutdownKinect()
int startVideo(VideoHandler handler)