@Test public void setOnCapTouchListener() throws IOException { final boolean[] expectedStatus = new boolean[CONFIGURATION.channelCount]; int activeChannels = 0; for (int i = 0; i < expectedStatus.length; i += 2) { expectedStatus[i] = true; activeChannels |= (1 << i); } Mockito.when(mI2c.readRegByte(0x03)).thenReturn((byte) activeChannels); Mockito.when(mI2c.readRegByte(0x00)).thenReturn((byte) 0b00000001); Mockito.doAnswer(new ArrayFillingAnswer((byte) 10)) .when(mI2c) .readRegBuffer(eq(0x10), any(byte[].class), eq(CONFIGURATION.channelCount)); Mockito.doAnswer(new ArrayFillingAnswer((byte) 5)) .when(mI2c) .readRegBuffer(eq(0x30), any(byte[].class), eq(CONFIGURATION.channelCount)); OnCapTouchListener mockListener = Mockito.mock(OnCapTouchListener.class); mDriver.setOnCapTouchListener(mockListener); mDriver.handleInterrupt(); Mockito.verify(mockListener, times(1)).onCapTouchEvent(eq(mDriver), aryEq(expectedStatus)); mDriver.setOnCapTouchListener(null); mDriver.handleInterrupt(); Mockito.verifyNoMoreInteractions(mockListener); }
public void setOnCapTouchListener(OnCapTouchListener listener) { mCapTouchListener = listener; }
Cap1xxx implements AutoCloseable { public void setOnCapTouchListener(OnCapTouchListener listener) { mCapTouchListener = listener; } }
Cap1xxx implements AutoCloseable { public void setOnCapTouchListener(OnCapTouchListener listener) { mCapTouchListener = listener; } @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip);  Cap1xxx(String i2cName, String alertName, Configuration chip); @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip,
            Handler handler);  Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler);  Cap1xxx(String i2cName, int i2cAddress, String alertName, Configuration chip, Handler handler); @VisibleForTesting  Cap1xxx(I2cDevice i2cDevice, Gpio alertPin, Configuration chip); }
Cap1xxx implements AutoCloseable { public void setOnCapTouchListener(OnCapTouchListener listener) { mCapTouchListener = listener; } @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip);  Cap1xxx(String i2cName, String alertName, Configuration chip); @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip,
            Handler handler);  Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler);  Cap1xxx(String i2cName, int i2cAddress, String alertName, Configuration chip, Handler handler); @VisibleForTesting  Cap1xxx(I2cDevice i2cDevice, Gpio alertPin, Configuration chip); void setOnCapTouchListener(OnCapTouchListener listener); void setRepeatRate(@RepeatRate int rate); void setSensitivity(@Sensitivity int sensitivity); void setLedFade(@LedFade int ledFade); void setLedBrightness(float ledBrightness); void setMultitouchInputMax(int count); boolean readInterruptFlag(); boolean readInterruptFlag(boolean clear); void clearInterruptFlag(); boolean readInputChannel(int channel); boolean readLedState(int ledIndex); void setLedState(int ledIndex, boolean state); int getInputChannelCount(); int getMaximumTouchPoints(); int getLedCount(); @Override void close(); void setInputsEnabled(boolean enable); void setInterruptsEnabled(boolean enable); void setRepeatEnabled(boolean enable); void setLedInputLinkEnabled(boolean enable); }
Cap1xxx implements AutoCloseable { public void setOnCapTouchListener(OnCapTouchListener listener) { mCapTouchListener = listener; } @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip);  Cap1xxx(String i2cName, String alertName, Configuration chip); @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip,
            Handler handler);  Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler);  Cap1xxx(String i2cName, int i2cAddress, String alertName, Configuration chip, Handler handler); @VisibleForTesting  Cap1xxx(I2cDevice i2cDevice, Gpio alertPin, Configuration chip); void setOnCapTouchListener(OnCapTouchListener listener); void setRepeatRate(@RepeatRate int rate); void setSensitivity(@Sensitivity int sensitivity); void setLedFade(@LedFade int ledFade); void setLedBrightness(float ledBrightness); void setMultitouchInputMax(int count); boolean readInterruptFlag(); boolean readInterruptFlag(boolean clear); void clearInterruptFlag(); boolean readInputChannel(int channel); boolean readLedState(int ledIndex); void setLedState(int ledIndex, boolean state); int getInputChannelCount(); int getMaximumTouchPoints(); int getLedCount(); @Override void close(); void setInputsEnabled(boolean enable); void setInterruptsEnabled(boolean enable); void setRepeatEnabled(boolean enable); void setLedInputLinkEnabled(boolean enable); static final int DEFAULT_I2C_ADDRESS; static final int REPEAT_DISABLE; static final int REPEAT_FAST; static final int REPEAT_NORMAL; static final int REPEAT_SLOW; static final int SENSITIVITY_HIGH; static final int SENSITIVITY_NORMAL; static final int SENSITIVITY_LOW; static final int LED_FADE_INSTANT; static final int LED_FADE_FAST; static final int LED_FADE_SLOW; }