Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ama/src/test/java/edu/mit/dig/ama/JavaUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,41 @@ public void isStringAccessibleFalse() {

}

/**
* Tests that the luminance of white is 1
*/
@Test
public void calcLuminanceWhite() {
int[] comps = new int[] {1, 255, 255, 255};
assertEquals("Luminance of white is 1", 1.0, AMA.calcLuminance(comps), 0.0001);
}

/**
* Tests that the luminance of black is 0
*/
@Test
public void calcLuminanceBlack() {
int[] comps = new int[] {1, 0, 0, 0};
assertEquals("Luminance of black is 0", 0, AMA.calcLuminance(comps), 0.0001);
}

/**
* Tests if VoiceInputMethod package name is enabled
*/
@Test
public void testVoiceTypingEnabled() {
String[] packs = new String[] {"VoiceInputMethod"};
assertTrue("Expect package to be enabled", AMA.isVoiceTypingEnabled(packs));
}

/**
* Tests if VoiceInputMethod package name is not enabled
*/
@Test
public void testVoiceTypingNotEnabled() {
String[] packs = new String[] {"Nope4"};
assertFalse("Expect package to not be enabled", AMA.isVoiceTypingEnabled(packs));
}


}