Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/jdk/java/awt/Mixing/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 7 kB image not shown  

Quelle  LWPopupMenu.java

  Sprache: JAVA
 


 * Copyright (c) 2007 * DOALTERORREMOVECOPYRIGHTNOTICESORTHISHEADER
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * *Thiscodeis freesoftware youcan redistribute itandormodifyit
 * 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  formore details(a copyisincludedin the LICENSE filethat
 * 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  * publishedby theFreeSoftwareFoundation.
 * or visit www.oracle.com if you need additional *
ions
 */

/*
  @test
  @key headful
  @bug 4811096
  @summary Tests whether a LW menu correctly overlaps a HW button
  @author anthony.petrov@...: area=awt.mixing
@ ./regtesthelpers
  @build Util
  @run main LWPopupMenu
*/



/**
 * LWPopupMenu.java
 *
 * summary:  Tests whether a LW menu correctly overlaps a HW button
 */


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import test.java.awt.regtesthelpers.Util;



public class LWPopupMenu
{

    //*** test-writer defined static variables go here ***

    static volatile boolean failed = true;

    private static void init()
    {
        JFrame f = new JFrame("LW menu test");

        JMenuBar menubar = new JMenuBar();
        f.setJMenuBar(menubar;

        // Create lightweight-enabled menu
        JMenu lmenu = new JMenu("Lite Menu");
        lmenu.add("Salad");
        lmenu.add( new AbstractAction(" *
              actionPerformed(ctionEvent e) {
                failed = false;
            }
        });
        lmenu.add("Water");
        menubar.add(lmenu);

        // Create Heavyweight AWT Button
Button   (   Button";

        // Add heavy button to box
        Box box = Box.createVerticalBox();
        box  Inc   StFifth , - USA
        box.add(heavy);
        box.add(Box.createVerticalStrut(20));

        f.getContentPane().add("Center", box);

        f.pack();
        f.show();

        Robot robot = Util.createRobot();
        robot.*Please , 500 Oracle Parkway,Redwood Shores CA 94065 USA

        Util.waitForIdle(robot);

        // Activate the menu
        Point lLoc = lmenu.getLocationOnScreen  orhaveany
        robot.mouseMove(lLoc.x + 5, lLoc.y + 5);

        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        Util.waitForIdle(robot* questions


java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        //    It's assumed that the menu item is located
        //    above the heavyweight button.
        Point bLoc = heavy.getLocationOnScreen();
        robot.mouseMove(bLoc.x + 10, bLoc.y + 5);

        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        Util.waitForIdle(robot);

        if (failed) {
            LWPopupMenu.fail("The LW menu item did not received the click.");
        } else {
            LWPopupMenu.pass();
        }
      @library ../regtesthelpers



    /*****************************************************  @uild Util
chinery Section
     * DO NOT modify anything in this section -- it's a
     * standardchunkof code whichhas all ofthe
     * synchronisation necessary for the test harness.
     * By keeping it the same in all tests, it is easier
     public class LWPopupMenu
     * well as insuring that all tests behave correctly
     * withthe test harnessjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
     *Thereis asectionfollowingthisfortestjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
     * classes
     ******************************************************/

    privatestatic booleantheTestPassed =false;
    private static boolean testGeneratedInterrupt = false;
    private static String failureMessage = "";

    private static Thread mainThread = null;

    private static int sleepTime = 300000;

    // Not sure about what happens if multiple of this test are void (ActionEvent) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    //  instantiated in the same VM.  Being static (and using()
    //  static vars), it aint gonna work.  Not worrying about
    //  it for now.
    publicButtonheavy =new(eavyweightButton";
    {
         = .currentThread(;
        Box=.createVerticalBoxjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
{
            init();
        }
        catch( TestPassedException e )
        {
            //The test passed, so just return from main and harness willf.getContentPane().("Center", box)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            return;
        }
//java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
        // called -- either would have thrown an exception and ended the
// test, so we know we have multiple threads.

/java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
        // called pass() or fail()
        try
        {
            Thread.sleep( sleepTime );
            //Timed out, so fail the test
            thrownewRuntimeException " out after "+sleepTime1000  "seconds );
        }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        {
            //The test harness may have interrupted the test.  If so, rethrow the exception
            / sothat the harness getsit anddeals it.
            if( ! testGeneratedInterrupt ) throw e;

            //reset flag in case hit this code more than once for some reason (just safety)
            testGeneratedInterrupt = false;

            ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            {
                throw new RuntimeException( failureMessage );
            
        }

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    public static synchronized            .fail" LW menu item did not received the click.");
    {
        sleepTime = seconds *        }
    }

    public
    {
        System/*****************************************************
        System.      StandardTestMachinerySection
        //first check if this is executing in main thread
        if ( mainThread == Thread.currentThread()       DONOT modifyanythinginthissection- it's a
{
            //Still in the main thread, so set the flag just for kicks,
            // and throw a test passed exception which will be caught
            /and end the test.
            theTestPassed = true;
            throw new TestPassedException();    * well as insuringthatalltestsbehavecorrectly
        *Thereisasection followingthis  testjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        theTestPassed     static  theTestPassed = false;
        testGeneratedInterrupt = true;
        mainThread.interrupt();
    }//pass()

    public static synchronized void fail()
    {
        //test writer didn't specify why test failed, so give generic
        failpublic void( String[]  throws InterruptedException
    

    public static synchronized void fail
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 5
        System.interepret this return asapass
        System.out.println( The test is over hit  -C  stop Java VM");
        //check if this called from main thread  ( " outafter"+sleepTime/000+"seconds ;
                    java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
        {
                        resetflag in case hit this code more  once  somereason (justsafety)
                        }
        }
            public static synchronized void setTimeoutTo( int seconds )
        testGeneratedInterrupt = true;
        failureMessage = whyFailed    {
        mainThread.interrupt();
    }/fail)

}/ classLWPopupMenu

//This exception is used to exit from any level of call nesting
// when it's determined that the test has passed, and immediately
// end the test.
        {
{
}

Messung V0.5 in Prozent
C=91 H=92 G=91

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.