1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 19:49:30 +01:00

Improved testcase #234

This commit is contained in:
cpfeiffer 2016-03-20 12:18:43 +01:00
parent e59c012553
commit b3410dcebe
2 changed files with 9 additions and 1 deletions

View File

@ -46,9 +46,15 @@ public class Mi1SFirmwareInfo extends AbstractMi1SFirmwareInfo {
return false;
}
try {
return fw1Info.isGenerallySupportedFirmware() && fw2Info.isGenerallySupportedFirmware();
return fw1Info.isGenerallySupportedFirmware()
&& fw2Info.isGenerallySupportedFirmware()
&& fw1Info.getFirmwareBytes().length > 0
&& fw2Info.getFirmwareBytes().length > 0;
} catch (IndexOutOfBoundsException ex) {
return false;
} catch (IllegalArgumentException ex) {
LOG.warn("not supported 1S firmware: ", ex);
return false;
}
}

View File

@ -33,6 +33,7 @@ public class FirmwareTest {
int calculatedVersion = info.getFirmwareVersion();
String version = MiBandFWHelper.formatFirmwareVersion(calculatedVersion);
Assert.assertTrue(version.startsWith("1."));
Assert.assertArrayEquals(wholeFw, info.getFirmwareBytes());
// Assert.assertEquals("Unexpected firmware version: " + calculatedVersion, MI_FW_VERSION, calculatedVersion);
}
@ -45,6 +46,7 @@ public class FirmwareTest {
int calculatedVersion = info.getFirmwareVersion();
String version = MiBandFWHelper.formatFirmwareVersion(calculatedVersion);
Assert.assertTrue(version.startsWith("5."));
Assert.assertArrayEquals(wholeFw, info.getFirmwareBytes());
// Assert.assertEquals("Unexpected firmware version: " + calculatedVersion, MI1A_FW_VERSION, calculatedVersion);
}