SystemPropTest_3.java revision 8729:0242fce0f717
1293531Sdchagin/*
2293531Sdchagin * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
3293531Sdchagin * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4293531Sdchagin *
5293531Sdchagin * This code is free software; you can redistribute it and/or modify it
6293531Sdchagin * under the terms of the GNU General Public License version 2 only, as
7293531Sdchagin * published by the Free Software Foundation.
8293531Sdchagin *
9293531Sdchagin * This code is distributed in the hope that it will be useful, but WITHOUT
10293531Sdchagin * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11293531Sdchagin * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12293531Sdchagin * version 2 for more details (a copy is included in the LICENSE file that
13293531Sdchagin * accompanied this code).
14293531Sdchagin *
15293531Sdchagin * You should have received a copy of the GNU General Public License version
16293531Sdchagin * 2 along with this work; if not, write to the Free Software Foundation,
17293531Sdchagin * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18293531Sdchagin *
19293531Sdchagin * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20293531Sdchagin * or visit www.oracle.com if you need additional information or have any
21293531Sdchagin * questions.
22293531Sdchagin */
23293531Sdchagin
24293531Sdchagin/*
25293531Sdchagin  @test %I% %E%
26293531Sdchagin  @bug 6315717
27293531Sdchagin  @summary verifies that system property sun.awt.enableExtraMouseButtons might be set to false by the command line
28293531Sdchagin  @author Andrei Dmitriev : area=awt.mouse
29293531Sdchagin  @run main/othervm -Dsun.awt.enableExtraMouseButtons=false SystemPropTest_3
30293531Sdchagin */
31293531Sdchagin//1) Verifies that System.getProperty("sun.awt.enableExtraMouseButtons") returns false if set through the command line.
32293531Sdchagin//2) Verifies that Toolkit.areExtraMouseButtonsEnabled() returns false if the proprty is set through the command line.
33293531Sdchaginimport java.awt.*;
34293531Sdchagin
35293531Sdchaginpublic class SystemPropTest_3 {
36293531Sdchagin
37293531Sdchagin    public static void main(String []s){
38293531Sdchagin        boolean propValue = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons"));
39293531Sdchagin        System.out.println("Test System.getProperty = " + System.getProperty("sun.awt.enableExtraMouseButtons"));
40293531Sdchagin        System.out.println("System.getProperty = " + propValue);
41293531Sdchagin        if (propValue){
42293531Sdchagin            throw new RuntimeException("TEST FAILED : System property sun.awt.enableExtraMouseButtons = " + propValue);
43293531Sdchagin        }
44293531Sdchagin        if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
45293531Sdchagin            throw new RuntimeException("TEST FAILED : Toolkit.areExtraMouseButtonsEnabled() returns true");
46293531Sdchagin        }
47293531Sdchagin        System.out.println("Test passed.");
48293531Sdchagin    }
49293531Sdchagin}
50293531Sdchagin