test/jdk/java/awt/Mixing/Validating.java
author jboes
Fri, 08 Nov 2019 11:15:16 +0000
changeset 59029 3786a0962570
parent 52545 e944ea36af05
permissions -rw-r--r--
8232853: AuthenticationFilter.Cache::remove may throw ConcurrentModificationException Summary: Change implementation to use iterator instead of plain LinkedList Reviewed-by: dfuchs, vtewari
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     1
/*
50834
9cf279436b9d 8205153: Delete "standard instructions" machinery in the open automated tests
serb
parents: 47216
diff changeset
     2
 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     4
 *
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     8
 *
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    13
 * accompanied this code).
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    14
 *
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1184
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1184
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1184
diff changeset
    21
 * questions.
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    22
 */
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    23
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    24
/*
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    25
  @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 5506
diff changeset
    26
  @key headful
52545
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    27
  @bug 6682046 8198002
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    28
  @summary Mixing code does not always recalculate shapes correctly when resizing components
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    29
  @author anthony.petrov@...: area=awt.mixing
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    30
  @library ../regtesthelpers
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    31
  @build Util
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    32
  @run main Validating
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    33
*/
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    34
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    35
/**
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    36
 * Validating.java
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    37
 *
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    38
 * summary:  Mixing code does not always recalculate shapes correctly when resizing components
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    39
 */
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    40
52545
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    41
import java.awt.Button;
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    42
import java.awt.event.InputEvent;
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    43
import java.awt.Frame;
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    44
import java.awt.Point;
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    45
import java.awt.Robot;
e944ea36af05 8198002: java/awt/Mixing/Validating.java debug assert on Windows
arapte
parents: 50834
diff changeset
    46
import java.awt.Toolkit;
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    47
import test.java.awt.regtesthelpers.Util;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    48
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    49
public class Validating
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    50
{
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    51
    static volatile boolean clickPassed = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    52
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    53
    private static void init()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    54
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    55
        if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    56
            System.out.println("The test environment does not support maximization. The test cannot be performed.");
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    57
            pass();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    58
            return;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    59
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    60
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    61
        // Create the frame with a button.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    62
        Frame f = new Frame();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    63
        Button b = new Button("ok");
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    64
        b.addActionListener(new java.awt.event.ActionListener() {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    65
            public void actionPerformed(java.awt.event.ActionEvent e) {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    66
                clickPassed = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    67
            }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    68
        });
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    69
        f.add(b);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    70
        // Make the frame maximized
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    71
        f.setExtendedState(Frame.MAXIMIZED_BOTH);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    72
        f.pack();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    73
        f.setVisible(true);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    74
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    75
        Robot robot = Util.createRobot();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    76
        robot.setAutoDelay(20);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    77
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    78
        Util.waitForIdle(robot);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    79
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    80
        // Now let's attempt to click in the middle of the button
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    81
        // (i.e. in the middle of the window).
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    82
        // If the button doesn't receive the click, it means that the test
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    83
        // failed: the shape of the button was not enlarged.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    84
        Point heavyLoc = b.getLocationOnScreen();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    85
        robot.mouseMove(heavyLoc.x + b.getWidth() / 2, heavyLoc.y + b.getHeight() / 2);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    86
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    87
        robot.mousePress(InputEvent.BUTTON1_MASK);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    88
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    89
        Util.waitForIdle(robot);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    90
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    91
        if (clickPassed) {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    92
            pass();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    93
        } else {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    94
            fail("The button cannot be clicked.");
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    95
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    96
    }//End  init()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    97
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    98
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    99
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   100
    /*****************************************************
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   101
     * Standard Test Machinery Section
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   102
     * DO NOT modify anything in this section -- it's a
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   103
     * standard chunk of code which has all of the
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   104
     * synchronisation necessary for the test harness.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   105
     * By keeping it the same in all tests, it is easier
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   106
     * to read and understand someone else's test, as
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   107
     * well as insuring that all tests behave correctly
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   108
     * with the test harness.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   109
     * There is a section following this for test-
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   110
     * classes
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   111
     ******************************************************/
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   112
    private static boolean theTestPassed = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   113
    private static boolean testGeneratedInterrupt = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   114
    private static String failureMessage = "";
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   115
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   116
    private static Thread mainThread = null;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   117
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   118
    private static int sleepTime = 300000;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   119
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   120
    // Not sure about what happens if multiple of this test are
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   121
    //  instantiated in the same VM.  Being static (and using
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   122
    //  static vars), it aint gonna work.  Not worrying about
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   123
    //  it for now.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   124
    public static void main( String args[] ) throws InterruptedException
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   125
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   126
        mainThread = Thread.currentThread();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   127
        try
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   128
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   129
            init();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   130
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   131
        catch( TestPassedException e )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   132
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   133
            //The test passed, so just return from main and harness will
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   134
            // interepret this return as a pass
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   135
            return;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   136
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   137
        //At this point, neither test pass nor test fail has been
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   138
        // called -- either would have thrown an exception and ended the
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   139
        // test, so we know we have multiple threads.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   140
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   141
        //Test involves other threads, so sleep and wait for them to
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   142
        // called pass() or fail()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   143
        try
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   144
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   145
            Thread.sleep( sleepTime );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   146
            //Timed out, so fail the test
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   147
            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   148
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   149
        catch (InterruptedException e)
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   150
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   151
            //The test harness may have interrupted the test.  If so, rethrow the exception
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   152
            // so that the harness gets it and deals with it.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   153
            if( ! testGeneratedInterrupt ) throw e;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   154
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   155
            //reset flag in case hit this code more than once for some reason (just safety)
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   156
            testGeneratedInterrupt = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   157
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   158
            if ( theTestPassed == false )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   159
            {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   160
                throw new RuntimeException( failureMessage );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   161
            }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   162
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   163
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   164
    }//main
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   165
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   166
    public static synchronized void setTimeoutTo( int seconds )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   167
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   168
        sleepTime = seconds * 1000;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   169
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   170
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   171
    public static synchronized void pass()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   172
    {
50834
9cf279436b9d 8205153: Delete "standard instructions" machinery in the open automated tests
serb
parents: 47216
diff changeset
   173
        System.out.println( "The test passed." );
9cf279436b9d 8205153: Delete "standard instructions" machinery in the open automated tests
serb
parents: 47216
diff changeset
   174
        System.out.println( "The test is over, hit  Ctl-C to stop Java VM" );
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   175
        //first check if this is executing in main thread
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   176
        if ( mainThread == Thread.currentThread() )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   177
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   178
            //Still in the main thread, so set the flag just for kicks,
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   179
            // and throw a test passed exception which will be caught
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   180
            // and end the test.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   181
            theTestPassed = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   182
            throw new TestPassedException();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   183
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   184
        theTestPassed = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   185
        testGeneratedInterrupt = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   186
        mainThread.interrupt();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   187
    }//pass()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   188
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   189
    public static synchronized void fail()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   190
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   191
        //test writer didn't specify why test failed, so give generic
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   192
        fail( "it just plain failed! :-)" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   193
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   194
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   195
    public static synchronized void fail( String whyFailed )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   196
    {
50834
9cf279436b9d 8205153: Delete "standard instructions" machinery in the open automated tests
serb
parents: 47216
diff changeset
   197
        System.out.println( "The test failed: " + whyFailed );
9cf279436b9d 8205153: Delete "standard instructions" machinery in the open automated tests
serb
parents: 47216
diff changeset
   198
        System.out.println( "The test is over, hit  Ctl-C to stop Java VM" );
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   199
        //check if this called from main thread
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   200
        if ( mainThread == Thread.currentThread() )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   201
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   202
            //If main thread, fail now 'cause not sleeping
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   203
            throw new RuntimeException( whyFailed );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   204
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   205
        theTestPassed = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   206
        testGeneratedInterrupt = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   207
        failureMessage = whyFailed;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   208
        mainThread.interrupt();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   209
    }//fail()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   210
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   211
}// class Validating
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   212
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   213
//This exception is used to exit from any level of call nesting
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   214
// when it's determined that the test has passed, and immediately
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   215
// end the test.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   216
class TestPassedException extends RuntimeException
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   217
{
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   218
}