jdk/test/java/awt/AlphaComposite/TestAlphaCompositeForNaN.java
changeset 4955 e99245ecb5b2
child 21596 0e3a39f29dbc
equal deleted inserted replaced
4954:1f09a5b49505 4955:e99245ecb5b2
       
     1 /*
       
     2  * @test
       
     3  * @bug 6918065
       
     4  * @summary Test for passing NaN as alpha
       
     5  *          should throw IllegalArgumentException
       
     6  */
       
     7 
       
     8 import java.awt.*;
       
     9 
       
    10 public class TestAlphaCompositeForNaN {
       
    11   public static void main(String[] args) {
       
    12     try {
       
    13       AlphaComposite a = AlphaComposite.getInstance(AlphaComposite.DST, Float.NaN);
       
    14       System.out.println("Failed");
       
    15       throw new RuntimeException(a + " failed to throw IllegalArgumentException for alpha = " + Float.NaN);
       
    16     }
       
    17     catch (IllegalArgumentException ie) {
       
    18       System.out.println("Passed");
       
    19       System.out.println("Caught " + ie);
       
    20     }
       
    21   }
       
    22 }