Example #1
0
 /** Tests the {@link Transfer#status()} methods. */
 @Test
 public void testGetStatus() {
   assumeUsbTestsEnabled();
   final Transfer transfer = LibUsb.allocTransfer(0);
   assertEquals(0, transfer.status());
   LibUsb.freeTransfer(transfer);
 }
Example #2
0
 /**
  * Tests the {@link Transfer#setDevHandle(DeviceHandle)} and {@link Transfer#devHandle()} methods.
  */
 @Test
 public void testDevHandle() {
   assumeUsbTestsEnabled();
   final Transfer transfer = LibUsb.allocTransfer(0);
   final DeviceHandle handle = new DeviceHandle();
   this.setPointer(handle, 1);
   final DeviceHandle handle2 = new DeviceHandle();
   this.setPointer(handle2, 2);
   assertNull(transfer.devHandle());
   transfer.setDevHandle(handle);
   assertNotNull(transfer.devHandle());
   assertNotSame(handle, transfer.devHandle());
   assertNotEquals(handle2, transfer.devHandle());
   assertEquals(handle, transfer.devHandle());
   transfer.setDevHandle(null);
   assertNull(transfer.devHandle());
   LibUsb.freeTransfer(transfer);
 }
Example #3
0
 /** Tests the {@link Transfer#setTimeout(long)} and {@link Transfer#timeout()} methods. */
 @Test
 public void testTimeout() {
   assumeUsbTestsEnabled();
   final Transfer transfer = LibUsb.allocTransfer(0);
   assertEquals(0, transfer.timeout());
   transfer.setTimeout(1);
   assertEquals(1, transfer.timeout());
   transfer.setTimeout(0);
   assertEquals(0, transfer.timeout());
   LibUsb.freeTransfer(transfer);
 }
Example #4
0
 /** Tests the {@link Transfer#setType(byte)} and {@link Transfer#type()} methods. */
 @Test
 public void testType() {
   assumeUsbTestsEnabled();
   final Transfer transfer = LibUsb.allocTransfer(0);
   assertEquals(0, transfer.type());
   transfer.setType((byte) 1);
   assertEquals(1, transfer.type());
   transfer.setType((byte) 0);
   assertEquals(0, transfer.type());
   LibUsb.freeTransfer(transfer);
 }