9e58e72bf6
clang-format had no config here, so adopting the submodule's puts both repos on the same pointer alignment. .editorconfig is what lua-language-server reads on save, which is why the Lua tree had drifted between tabs and two widths.
38 lines
930 B
Lua
38 lines
930 B
Lua
-- Run: lua test/ble.lua
|
|
package.path = "sdcard/.lua/lib/?.lua;test/?.lua;" .. package.path
|
|
|
|
local device = require "fake_device"
|
|
device.bleDevices = { { name = "Sensor", address = "aa:bb:cc:dd:ee:ff", rssi = -42 } }
|
|
device.install()
|
|
|
|
dofile "sdcard/.lua/apps/Settings/main.lua"
|
|
|
|
init()
|
|
device.tap "BLE"
|
|
assert(device.labelled "off")
|
|
assert(not device.find "disconnect")
|
|
|
|
device.tap "turn on"
|
|
assert(device.bleName == "Slate32 BLE")
|
|
device.tap "scan devices"
|
|
assert(device.labelled "scanning BLE")
|
|
tick()
|
|
assert(device.labelled "Sensor")
|
|
|
|
device.tap "Sensor"
|
|
assert(device.labelled "connecting BLE")
|
|
tick()
|
|
assert(device.bleConnected == "aa:bb:cc:dd:ee:ff")
|
|
assert(device.find "disconnect")
|
|
|
|
device.tap "disconnect"
|
|
device.tap "start advertising"
|
|
assert(device.bleAdvertising == "Slate32 BLE")
|
|
device.tap "stop advertising"
|
|
assert(device.bleAdvertising == nil)
|
|
|
|
device.tap "turn off"
|
|
assert(not device.bleInitialized)
|
|
|
|
print "ok"
|