RosettaCodeData/Task/Bitmap/Java/bitmap-2.java

23 lines
567 B
Java
Raw Normal View History

2018-06-22 20:57:24 +00:00
import static org.junit.Assert.assertEquals;
2013-04-10 16:19:29 -07:00
import java.awt.Color;
2018-06-22 20:57:24 +00:00
import org.junit.Test;
public class BasicBitmapStorageTest {
2013-04-10 16:19:29 -07:00
2018-06-22 20:57:24 +00:00
@Test
public void testHappy() {
int width = 640;
int height = 480;
2013-04-10 16:19:29 -07:00
2018-06-22 20:57:24 +00:00
BasicBitmapStorage bbs = new BasicBitmapStorage(width, height);
bbs.fill(Color.CYAN);
bbs.setPixel(width / 2, height / 2, Color.BLACK);
Color c1 = bbs.getPixel(width / 2, height / 2);
Color c2 = bbs.getPixel(20, 20);
2013-04-10 16:19:29 -07:00
2018-06-22 20:57:24 +00:00
assertEquals(Color.BLACK, c1);
assertEquals(Color.CYAN, c2);
}
2013-04-10 16:19:29 -07:00
}