Initial load
diff --git a/test/java/awt/Graphics/DrawImageBG/SystemBgColorTest.java b/test/java/awt/Graphics/DrawImageBG/SystemBgColorTest.java
new file mode 100644
index 0000000..f11b834
--- /dev/null
+++ b/test/java/awt/Graphics/DrawImageBG/SystemBgColorTest.java
@@ -0,0 +1,98 @@
+/*
+ * @test
+ * @bug     4614845
+ * @summary Test drawImage(bgcolor) gets correct RGB from SystemColor objects.
+ * @run     main SystemBgColorTest
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class SystemBgColorTest {
+    public static final int TESTW = 10;
+    public static final int TESTH = 10;
+
+    static SystemColor systemColorObjects [] = {
+        SystemColor.desktop,
+        SystemColor.activeCaption,
+        SystemColor.activeCaptionText,
+        SystemColor.activeCaptionBorder,
+        SystemColor.inactiveCaption,
+        SystemColor.inactiveCaptionText,
+        SystemColor.inactiveCaptionBorder,
+        SystemColor.window,
+        SystemColor.windowBorder,
+        SystemColor.windowText,
+        SystemColor.menu,
+        SystemColor.menuText,
+        SystemColor.text,
+        SystemColor.textText,
+        SystemColor.textHighlight,
+        SystemColor.textHighlightText,
+        SystemColor.textInactiveText,
+        SystemColor.control,
+        SystemColor.controlText,
+        SystemColor.controlHighlight,
+        SystemColor.controlLtHighlight,
+        SystemColor.controlShadow,
+        SystemColor.controlDkShadow,
+        SystemColor.scrollbar,
+        SystemColor.info,
+        SystemColor.infoText
+    };
+
+    static boolean counterrors;
+    static int errcount;
+
+    public static void error(String problem) {
+        if (counterrors) {
+            errcount++;
+        } else {
+            throw new RuntimeException(problem);
+        }
+    }
+
+    public static void main(String argv[]) {
+        counterrors = (argv.length > 0);
+        test(BufferedImage.TYPE_INT_ARGB);
+        test(BufferedImage.TYPE_INT_RGB);
+        if (errcount > 0) {
+            throw new RuntimeException(errcount+" errors");
+        }
+        System.exit(0); // For 1.3 and earlier VMs...
+    }
+
+    static int cmap[] = {
+        0x00000000,
+        0xffffffff,
+    };
+
+    public static void test(int dsttype) {
+        BufferedImage src =
+            new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_ARGB);
+        test(src, dsttype);
+        IndexColorModel icm = new IndexColorModel(8, 2, cmap, 0, true, 0,
+                                                  DataBuffer.TYPE_BYTE);
+        src = new BufferedImage(TESTW, TESTH,
+                                BufferedImage.TYPE_BYTE_INDEXED, icm);
+        test(src, dsttype);
+    }
+
+    public static void test(Image src, int dsttype) {
+        BufferedImage dst =
+            new BufferedImage(TESTW, TESTH, dsttype);
+        for (int i = 0; i < systemColorObjects.length; i++) {
+            test(src, dst, systemColorObjects[i]);
+        }
+    }
+
+    public static void test(Image src, BufferedImage dst, Color bg) {
+        Graphics g = dst.getGraphics();
+        g.setColor(Color.white);
+        g.fillRect(0, 0, TESTW, TESTH);
+        g.drawImage(src, 0, 0, bg, null);
+        if (dst.getRGB(0, 0) != bg.getRGB()) {
+            error("bad bg pixel for: "+bg);
+        }
+    }
+}
diff --git a/test/java/awt/Graphics/LCDTextAndGraphicsState.java b/test/java/awt/Graphics/LCDTextAndGraphicsState.java
new file mode 100644
index 0000000..23c3c40
--- /dev/null
+++ b/test/java/awt/Graphics/LCDTextAndGraphicsState.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6576507
+ * @summary Both lines of text should be readable
+ * @run main/manual=yesno LCDTextAndGraphicsState
+ */
+import java.awt.*;
+import java.awt.geom.*;
+
+public class LCDTextAndGraphicsState extends Component {
+
+    String text = "This test passes only if this text appears SIX TIMES";
+
+    public void paint(Graphics g) {
+
+        Graphics2D g2d = (Graphics2D)g.create();
+        g2d.setColor(Color.white);
+        g2d.fillRect(0,0,getSize().width, getSize().height);
+
+        test1(g.create(0,   0, 500, 200));
+        test2(g.create(0, 200, 500, 200));
+        test3(g.create(0, 400, 500, 200));
+    }
+
+    public void test1(Graphics g) {
+        Graphics2D g2d = (Graphics2D)g;
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+        g2d.setColor(Color.black);
+        g2d.drawString(text, 10, 50);
+        g2d.setComposite(AlphaComposite.getInstance(
+                         AlphaComposite.SRC_OVER, 0.9f));
+        g2d.drawString(text, 10, 80);
+    }
+
+    public void test2(Graphics g) {
+        Graphics2D g2d = (Graphics2D)g;
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+        g2d.setColor(Color.black);
+        g2d.drawString(text, 10, 50);
+        g2d.setPaint(new GradientPaint(
+                     0f, 0f, Color.BLACK, 100f, 100f, Color.GRAY));
+        g2d.drawString(text, 10, 80);
+    }
+
+    public void test3(Graphics g) {
+        Graphics2D g2d = (Graphics2D)g;
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+        g2d.setColor(Color.black);
+        g2d.drawString(text, 10, 50);
+        Shape s = new RoundRectangle2D.Double(0, 60, 400, 50, 5, 5);
+        g2d.clip(s);
+        g2d.drawString(text, 10, 80);
+    }
+
+    public Dimension getPreferredSize() {
+        return new Dimension(500,600);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        Frame f = new Frame("Composite and Text Test");
+        f.add(new LCDTextAndGraphicsState(), BorderLayout.CENTER);
+        f.pack();
+        f.setVisible(true);
+    }
+}
diff --git a/test/java/awt/Graphics/TextAAHintsTest.java b/test/java/awt/Graphics/TextAAHintsTest.java
new file mode 100644
index 0000000..d941c85
--- /dev/null
+++ b/test/java/awt/Graphics/TextAAHintsTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6263951
+ * @summary Text should be B&W, grayscale, and LCD.
+ * @run main/manual=yesno TextAAHintsTest
+ */
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+public class TextAAHintsTest extends Component {
+
+    String black = "This text should be solid black";
+    String gray  = "This text should be gray scale anti-aliased";
+    String lcd   = "This text should be LCD sub-pixel text (coloured).";
+
+    public void paint(Graphics g) {
+
+        Graphics2D g2d = (Graphics2D)g.create();
+        g2d.setColor(Color.white);
+        g2d.fillRect(0,0,getSize().width, getSize().height);
+
+        drawText(g.create(0, 0, 500, 100));
+        bufferedImageText(g.create(0, 100, 500, 100));
+        volatileImageText(g.create(0, 200, 500, 100));
+    }
+
+    private void drawText(Graphics g) {
+
+        Graphics2D g2d = (Graphics2D)g;
+
+        g2d.setColor(Color.white);
+        g2d.fillRect(0,0,500,100);
+
+        g2d.setColor(Color.black);
+        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                             RenderingHints.VALUE_ANTIALIAS_ON);
+
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
+        g2d.drawString(black, 10, 20);
+
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
+        g2d.drawString(black, 10, 35);
+
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
+        g2d.drawString(gray, 10, 50);
+
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+        g2d.drawString(gray, 10, 65);
+
+        /* For visual comparison, render grayscale with graphics AA off */
+        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                             RenderingHints.VALUE_ANTIALIAS_OFF);
+        g2d.drawString(gray, 10, 80);
+        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                             RenderingHints.VALUE_ANTIALIAS_ON);
+
+        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                             RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
+        g2d.drawString(lcd, 10, 95);
+    }
+
+    public void bufferedImageText(Graphics g) {
+        BufferedImage bi =
+                 new BufferedImage(500, 100, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = bi.createGraphics();
+
+        drawText(g2d);
+        g.drawImage(bi, 0, 0, null);
+    }
+
+    public VolatileImage getVolatileImage(int w, int h) {
+        VolatileImage image;
+        try {
+            image = createVolatileImage(w, h, new ImageCapabilities(true));
+        } catch (AWTException e) {
+            System.out.println(e);
+            System.out.println("Try creating non-accelerated VI instead.");
+            try {
+                image = createVolatileImage(w, h,
+                                            new ImageCapabilities(false));
+            } catch (AWTException e1) {
+                System.out.println("Skipping volatile image test.");
+                image = null;
+            }
+        }
+        return image;
+    }
+
+    public void volatileImageText(Graphics g) {
+        VolatileImage image = getVolatileImage(500, 100);
+        if (image == null) {
+            return;
+        }
+        boolean painted = false;
+        while (!painted) {
+            int status = image.validate(getGraphicsConfiguration());
+            if (status == VolatileImage.IMAGE_INCOMPATIBLE) {
+                image = getVolatileImage(500, 100);
+                if (image == null) {
+                    return;
+                }
+            }
+            drawText(image.createGraphics());
+            g.drawImage(image, 0, 0, null);
+            painted = !image.contentsLost();
+            System.out.println("painted = " + painted);
+        }
+    }
+
+    public Dimension getPreferredSize() {
+        return new Dimension(500,300);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        Frame f = new Frame("Composite and Text Test");
+        f.add(new TextAAHintsTest(), BorderLayout.CENTER);
+        f.pack();
+        f.setVisible(true);
+    }
+}