SystemPropTest_2.java revision 14851:980da45565c8
159191Skris/*
259191Skris * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
359191Skris * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
459191Skris *
559191Skris * This code is free software; you can redistribute it and/or modify it
659191Skris * under the terms of the GNU General Public License version 2 only, as
759191Skris * published by the Free Software Foundation.
859191Skris *
959191Skris * This code is distributed in the hope that it will be useful, but WITHOUT
1059191Skris * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1159191Skris * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1259191Skris * version 2 for more details (a copy is included in the LICENSE file that
1359191Skris * accompanied this code).
1459191Skris *
1559191Skris * You should have received a copy of the GNU General Public License version
1659191Skris * 2 along with this work; if not, write to the Free Software Foundation,
1759191Skris * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1859191Skris *
1959191Skris * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2059191Skris * or visit www.oracle.com if you need additional information or have any
2159191Skris * questions.
2259191Skris */
2359191Skris
2459191Skris/*
2559191Skris  @test %I% %E%
2659191Skris  @key headful
2759191Skris  @bug 6315717
2859191Skris  @summary verifies that system property sun.awt.enableExtraMouseButtons might be set to true by the command line
2959191Skris  @author Andrei Dmitriev : area=awt.mouse
3059191Skris  @run main/othervm -Dsun.awt.enableExtraMouseButtons=true SystemPropTest_2
3159191Skris */
3259191Skris//1) Verifies that System.getProperty("sun.awt.enableExtraMouseButtons") returns true if set through the command line.
3359191Skris//2) Verifies that Toolkit.areExtraMouseButtonsEnabled() returns true if the proprty is set through the command line.
3459191Skrisimport java.awt.*;
3559191Skris
3659191Skrispublic class SystemPropTest_2 {
3759191Skris
3859191Skris    public static void main(String []s){
39109998Smarkm        boolean propValue = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons"));
4059191Skris        System.out.println("System.getProperty = " + propValue);
4159191Skris        if (!propValue){
4259191Skris            throw new RuntimeException("TEST FAILED : System property sun.awt.enableExtraMouseButtons = " + propValue);
4359191Skris        }
4459191Skris        if (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
4559191Skris            throw new RuntimeException("TEST FAILED : Toolkit.areExtraMouseButtonsEnabled() returns false");
4659191Skris        }
4759191Skris        System.out.println("Test passed.");
48    }
49}
50