jdk/test/java/awt/Mixing/Validating.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 5506 202f599c92aa
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
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
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 5506
diff changeset
     2
 * Copyright (c) 2008, 2016, 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
1184
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    27
  @bug 6682046
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
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    41
import java.awt.*;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    42
import java.awt.event.*;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    43
import test.java.awt.regtesthelpers.Util;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    44
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    45
public class Validating
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    46
{
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    47
    static volatile boolean clickPassed = false;
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
    private static void init()
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
        //*** Create instructions for the user here ***
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
        String[] instructions =
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
            "This is an AUTOMATIC test, simply wait until it is done.",
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    56
            "The result (passed or failed) will be shown in the",
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    57
            "message window below."
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    58
        };
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    59
        Sysout.createDialog( );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    60
        Sysout.printInstructions( instructions );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    61
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    62
        if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    63
            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
    64
            pass();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    65
            return;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    66
        }
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
        // Create the frame with a button.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    69
        Frame f = new Frame();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    70
        Button b = new Button("ok");
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    71
        b.addActionListener(new java.awt.event.ActionListener() {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    72
            public void actionPerformed(java.awt.event.ActionEvent e) {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    73
                clickPassed = 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
        });
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    76
        f.add(b);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    77
        // Make the frame maximized
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    78
        f.setExtendedState(Frame.MAXIMIZED_BOTH);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    79
        f.pack();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    80
        f.setVisible(true);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    81
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    82
        Robot robot = Util.createRobot();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    83
        robot.setAutoDelay(20);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    84
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    85
        Util.waitForIdle(robot);
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
        // 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
    88
        // (i.e. in the middle of the window).
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    89
        // 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
    90
        // failed: the shape of the button was not enlarged.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    91
        Point heavyLoc = b.getLocationOnScreen();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    92
        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
    93
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    94
        robot.mousePress(InputEvent.BUTTON1_MASK);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    95
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    96
        Util.waitForIdle(robot);
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
        if (clickPassed) {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
    99
            pass();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   100
        } else {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   101
            fail("The button cannot be clicked.");
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   102
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   103
    }//End  init()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   104
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   105
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   106
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   107
    /*****************************************************
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   108
     * Standard Test Machinery Section
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   109
     * DO NOT modify anything in this section -- it's a
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   110
     * standard chunk of code which has all of the
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   111
     * synchronisation necessary for the test harness.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   112
     * By keeping it the same in all tests, it is easier
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   113
     * to read and understand someone else's test, as
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   114
     * well as insuring that all tests behave correctly
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   115
     * with the test harness.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   116
     * There is a section following this for test-
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   117
     * classes
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   118
     ******************************************************/
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   119
    private static boolean theTestPassed = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   120
    private static boolean testGeneratedInterrupt = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   121
    private static String failureMessage = "";
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   122
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   123
    private static Thread mainThread = null;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   124
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   125
    private static int sleepTime = 300000;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   126
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   127
    // Not sure about what happens if multiple of this test are
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   128
    //  instantiated in the same VM.  Being static (and using
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   129
    //  static vars), it aint gonna work.  Not worrying about
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   130
    //  it for now.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   131
    public static void main( String args[] ) throws InterruptedException
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
        mainThread = Thread.currentThread();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   134
        try
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   135
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   136
            init();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   137
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   138
        catch( TestPassedException e )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   139
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   140
            //The test passed, so just return from main and harness will
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   141
            // interepret this return as a pass
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   142
            return;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   143
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   144
        //At this point, neither test pass nor test fail has been
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   145
        // called -- either would have thrown an exception and ended the
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   146
        // test, so we know we have multiple threads.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   147
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   148
        //Test involves other threads, so sleep and wait for them to
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   149
        // called pass() or fail()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   150
        try
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   151
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   152
            Thread.sleep( sleepTime );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   153
            //Timed out, so fail the test
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   154
            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   155
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   156
        catch (InterruptedException e)
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
            //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
   159
            // so that the harness gets it and deals with it.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   160
            if( ! testGeneratedInterrupt ) throw e;
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
            //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
   163
            testGeneratedInterrupt = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   164
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   165
            if ( theTestPassed == false )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   166
            {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   167
                throw new RuntimeException( failureMessage );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   168
            }
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
    }//main
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   172
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   173
    public static synchronized void setTimeoutTo( int seconds )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   174
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   175
        sleepTime = seconds * 1000;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   176
    }
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
    public static synchronized void pass()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   179
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   180
        Sysout.println( "The test passed." );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   181
        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   182
        //first check if this is executing in main thread
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   183
        if ( mainThread == Thread.currentThread() )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   184
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   185
            //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
   186
            // and throw a test passed exception which will be caught
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   187
            // and end the test.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   188
            theTestPassed = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   189
            throw new TestPassedException();
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
        theTestPassed = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   192
        testGeneratedInterrupt = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   193
        mainThread.interrupt();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   194
    }//pass()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   195
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   196
    public static synchronized void fail()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   197
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   198
        //test writer didn't specify why test failed, so give generic
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   199
        fail( "it just plain failed! :-)" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   200
    }
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
    public static synchronized void fail( String whyFailed )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   203
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   204
        Sysout.println( "The test failed: " + whyFailed );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   205
        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   206
        //check if this called from main thread
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   207
        if ( mainThread == Thread.currentThread() )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   208
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   209
            //If main thread, fail now 'cause not sleeping
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   210
            throw new RuntimeException( whyFailed );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   211
        }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   212
        theTestPassed = false;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   213
        testGeneratedInterrupt = true;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   214
        failureMessage = whyFailed;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   215
        mainThread.interrupt();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   216
    }//fail()
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
}// class Validating
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   219
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   220
//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
   221
// when it's determined that the test has passed, and immediately
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   222
// end the test.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   223
class TestPassedException extends RuntimeException
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   224
{
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   225
}
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   226
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   227
//*********** End Standard Test Machinery Section **********
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   228
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   229
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   230
//************ Begin classes defined for the test ****************
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   231
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   232
// if want to make listeners, here is the recommended place for them, then instantiate
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   233
//  them in init()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   234
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   235
/* Example of a class which may be written as part of a test
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   236
class NewClass implements anInterface
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   237
 {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   238
   static int newVar = 0;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   239
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   240
   public void eventDispatched(AWTEvent e)
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   241
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   242
      //Counting events to see if we get enough
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   243
      eventCount++;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   244
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   245
      if( eventCount == 20 )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   246
       {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   247
         //got enough events, so pass
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   248
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   249
         Validating.pass();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   250
       }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   251
      else if( tries == 20 )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   252
       {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   253
         //tried too many times without getting enough events so fail
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   254
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   255
         Validating.fail();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   256
       }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   257
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   258
    }// eventDispatched()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   259
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   260
 }// NewClass class
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   261
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   262
*/
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   263
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   264
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   265
//************** End classes defined for the test *******************
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   266
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   267
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   268
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   269
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   270
/****************************************************
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   271
 Standard Test Machinery
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   272
 DO NOT modify anything below -- it's a standard
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   273
  chunk of code whose purpose is to make user
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   274
  interaction uniform, and thereby make it simpler
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   275
  to read and understand someone else's test.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   276
 ****************************************************/
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   277
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   278
/**
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   279
 This is part of the standard test machinery.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   280
 It creates a dialog (with the instructions), and is the interface
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   281
  for sending text messages to the user.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   282
 To print the instructions, send an array of strings to Sysout.createDialog
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   283
  WithInstructions method.  Put one line of instructions per array entry.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   284
 To display a message for the tester to see, simply call Sysout.println
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   285
  with the string to be displayed.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   286
 This mimics System.out.println but works within the test harness as well
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   287
  as standalone.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   288
 */
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   289
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   290
class Sysout
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   291
{
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   292
    private static TestDialog dialog;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   293
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   294
    public static void createDialogWithInstructions( String[] instructions )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   295
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   296
        dialog = new TestDialog( new Frame(), "Instructions" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   297
        dialog.printInstructions( instructions );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   298
        dialog.setVisible(true);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   299
        println( "Any messages for the tester will display here." );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   300
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   301
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   302
    public static void createDialog( )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   303
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   304
        dialog = new TestDialog( new Frame(), "Instructions" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   305
        String[] defInstr = { "Instructions will appear here. ", "" } ;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   306
        dialog.printInstructions( defInstr );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   307
        dialog.setVisible(true);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   308
        println( "Any messages for the tester will display here." );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   309
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   310
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   311
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   312
    public static void printInstructions( String[] instructions )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   313
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   314
        dialog.printInstructions( instructions );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   315
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   316
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   317
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   318
    public static void println( String messageIn )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   319
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   320
        dialog.displayMessage( messageIn );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   321
        System.out.println(messageIn);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   322
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   323
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   324
}// Sysout  class
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   325
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   326
/**
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   327
  This is part of the standard test machinery.  It provides a place for the
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   328
   test instructions to be displayed, and a place for interactive messages
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   329
   to the user to be displayed.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   330
  To have the test instructions displayed, see Sysout.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   331
  To have a message to the user be displayed, see Sysout.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   332
  Do not call anything in this dialog directly.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   333
  */
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   334
class TestDialog extends Dialog
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   335
{
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   336
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   337
    TextArea instructionsText;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   338
    TextArea messageText;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   339
    int maxStringLength = 80;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   340
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   341
    //DO NOT call this directly, go through Sysout
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   342
    public TestDialog( Frame frame, String name )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   343
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   344
        super( frame, name );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   345
        int scrollBoth = TextArea.SCROLLBARS_BOTH;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   346
        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   347
        add( "North", instructionsText );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   348
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   349
        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   350
        add("Center", messageText);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   351
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   352
        pack();
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   353
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   354
        setVisible(true);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   355
    }// TestDialog()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   356
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   357
    //DO NOT call this directly, go through Sysout
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   358
    public void printInstructions( String[] instructions )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   359
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   360
        //Clear out any current instructions
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   361
        instructionsText.setText( "" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   362
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   363
        //Go down array of instruction strings
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   364
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   365
        String printStr, remainingStr;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   366
        for( int i=0; i < instructions.length; i++ )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   367
        {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   368
            //chop up each into pieces maxSringLength long
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   369
            remainingStr = instructions[ i ];
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   370
            while( remainingStr.length() > 0 )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   371
            {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   372
                //if longer than max then chop off first max chars to print
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   373
                if( remainingStr.length() >= maxStringLength )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   374
                {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   375
                    //Try to chop on a word boundary
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   376
                    int posOfSpace = remainingStr.
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   377
                        lastIndexOf( ' ', maxStringLength - 1 );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   378
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   379
                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   380
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   381
                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   382
                    remainingStr = remainingStr.substring( posOfSpace + 1 );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   383
                }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   384
                //else just print
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   385
                else
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   386
                {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   387
                    printStr = remainingStr;
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   388
                    remainingStr = "";
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   389
                }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   390
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   391
                instructionsText.append( printStr + "\n" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   392
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   393
            }// while
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   394
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   395
        }// for
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   396
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   397
    }//printInstructions()
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   398
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   399
    //DO NOT call this directly, go through Sysout
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   400
    public void displayMessage( String messageIn )
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   401
    {
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   402
        messageText.append( messageIn + "\n" );
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   403
        System.out.println(messageIn);
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   404
    }
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   405
4ea848b954c8 6723018: Need to push the test for 6682046
anthony
parents:
diff changeset
   406
}// TestDialog  class