Fixed Android tests to work on emulator
This commit is contained in:
parent
f50d0697e6
commit
a4a50d0341
1 changed files with 7 additions and 3 deletions
|
@ -6,14 +6,18 @@ import android.test.AndroidTestCase
|
||||||
|
|
||||||
class BluetoothInterfaceTest extends AndroidTestCase {
|
class BluetoothInterfaceTest extends AndroidTestCase {
|
||||||
|
|
||||||
private lazy val adapter = new BluetoothInterface(getContext, new Handler(), null)
|
private lazy val btInterface = new BluetoothInterface(getContext, new Handler(), null)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for issue [[https://github.com/Nutomic/ensichat/issues/3 #3]].
|
* Test for issue [[https://github.com/Nutomic/ensichat/issues/3 #3]].
|
||||||
*/
|
*/
|
||||||
def testStartBluetoothOff(): Unit = {
|
def testStartBluetoothOff(): Unit = {
|
||||||
BluetoothAdapter.getDefaultAdapter.disable()
|
val btAdapter = BluetoothAdapter.getDefaultAdapter
|
||||||
adapter.create()
|
if (btAdapter == null)
|
||||||
|
return
|
||||||
|
|
||||||
|
btAdapter.disable()
|
||||||
|
btInterface.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue