1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
package com_yourdolphin;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.nio.charset.Charset;
import org.daisy.braille.BrailleConstants;
import org.daisy.braille.table.BrailleConverter;
import org.daisy.braille.table.EmbosserBrailleConverter.EightDotFallbackMethod;
import org.junit.Test;
public class SupernovaTableProviderTest {
private static SupernovaTableProvider bt = new SupernovaTableProvider();
@Test
public void testFeatureReplacement() {
assertEquals('\u2800', bt.getFeature("replacement"));
}
@Test
public void testFeatureFallback() {
assertEquals(EightDotFallbackMethod.MASK, bt.getFeature("fallback"));
}
@Test (expected=IllegalArgumentException.class)
public void testGetUnknownFeature() {
bt.getFeature("unknown-feature");
}
@Test (expected=IllegalArgumentException.class)
public void testSetUnknownFeature() {
bt.setFeature("unknown-feature", null);
}
@Test
public void testListLength() {
assertEquals("Assert that all tables have tests by counting the list length", 1, bt.list().size());
}
@Test
public void testTableSV_SE_6DOT() {
//BrailloTableProvider bt = new BrailloTableProvider();
String input = BrailleConstants.BRAILLE_PATTERNS_64;
SupernovaTableProvider.TableType t = SupernovaTableProvider.TableType.SV_SE_6DOT;
BrailleConverter ta = bt.newTable(t);
String text = ta.toText(input);
String braille = ta.toBraille(text);
assertEquals("Assert that conversion is reversible", input, braille);
assertEquals("Assert that text has been transformed", " a,b.k;l@cif/msp'e:h*o!rødjgäntq_å?ê-u(v`îöë§xèç\"û+ü)z=àœôwï#yùé", text);
assertTrue("Assert that table does not support 8-dot", !ta.supportsEightDot());
assertEquals("Assert that UTF-8 is the preferred charset", Charset.forName("UTF-8"), ta.getPreferredCharset());
}
}
|