FileDocCategorySizeDatePackage
TestColorSchemeAtom.javaAPI DocApache Poi 3.0.13316Mon Jan 01 18:56:12 GMT 2007org.apache.poi.hslf.record

TestColorSchemeAtom

public class TestColorSchemeAtom extends TestCase
Tests that ColorSchemAtom works properly
author
Nick Burch (nick at torchbox dot com)

Fields Summary
private byte[]
data_a
Constructors Summary
Methods Summary
public voidtestFromRGB()

		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 voidtestRGBs()

		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 voidtestRecordType()


         
		ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length);
		assertEquals(2032l, csa.getRecordType());
	
public voidtestToRGB()

		byte[] rgb = ColorSchemeAtom.splitRGB(3669760);

		assertEquals(3,rgb.length);
		assertEquals(0, rgb[0]);
		assertEquals(255-256, rgb[1]);
		assertEquals(55, rgb[2]);
	
public voidtestWrite()

		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]);
		}