TestColorSchemeAtompublic class TestColorSchemeAtom extends TestCase Tests that ColorSchemAtom works properly |
Fields Summary |
---|
private byte[] | data_a |
Methods Summary |
---|
public void | testFromRGB()
byte[] rgb_a = new byte[] { 0, 255-256, 55 };
byte[] rgb_b = new byte[] { 255-256, 127, 79 };
assertEquals( 3669760, ColorSchemeAtom.joinRGB( rgb_a ) );
assertEquals( 5210111, ColorSchemeAtom.joinRGB( rgb_b ) );
assertEquals( 3669760, ColorSchemeAtom.joinRGB( rgb_a[0], rgb_a[1], rgb_a[2] ) );
assertEquals( 5210111, ColorSchemeAtom.joinRGB( rgb_b[0], rgb_b[1], rgb_b[2] ) );
| public void | testRGBs()
ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length);
assertEquals( 16777215 , csa.getBackgroundColourRGB() );
assertEquals( 0 , csa.getTextAndLinesColourRGB() );
assertEquals( 8421504 , csa.getShadowsColourRGB() );
assertEquals( 0 , csa.getTitleTextColourRGB() );
assertEquals( 14934203 , csa.getFillsColourRGB() );
assertEquals( 10040115 , csa.getAccentColourRGB() );
assertEquals( 10066176 , csa.getAccentAndHyperlinkColourRGB() );
assertEquals( 52377 , csa.getAccentAndFollowingHyperlinkColourRGB() );
| public void | testRecordType()
ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length);
assertEquals(2032l, csa.getRecordType());
| public void | testToRGB()
byte[] rgb = ColorSchemeAtom.splitRGB(3669760);
assertEquals(3,rgb.length);
assertEquals(0, rgb[0]);
assertEquals(255-256, rgb[1]);
assertEquals(55, rgb[2]);
| public void | testWrite()
ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
csa.writeOut(baos);
byte[] b = baos.toByteArray();
assertEquals(data_a.length, b.length);
for(int i=0; i<data_a.length; i++) {
assertEquals(data_a[i],b[i]);
}
|
|