Path: blob/master/test/jdk/java/awt/Cursor/HeadlessCursor.java
41149 views
/*1* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.awt.*;2425/*26* @test27* @summary Check that Cursor constructors and methods do not throw unexpected28* exceptions in headless mode29* @run main/othervm -Djava.awt.headless=true HeadlessCursor30*/3132public class HeadlessCursor {33public static void main(String args[]) {34Cursor c;35c = new Cursor(Cursor.CROSSHAIR_CURSOR);36c.getType();37c.getName();38c = new Cursor(Cursor.DEFAULT_CURSOR);39c.getType();40c.getName();41c = new Cursor(Cursor.E_RESIZE_CURSOR);42c.getType();43c.getName();44c = new Cursor(Cursor.HAND_CURSOR);45c.getType();46c.getName();47c = new Cursor(Cursor.N_RESIZE_CURSOR);48c.getType();49c.getName();50c = new Cursor(Cursor.NE_RESIZE_CURSOR);51c.getType();52c.getName();53c = new Cursor(Cursor.NW_RESIZE_CURSOR);54c.getType();55c.getName();56c = new Cursor(Cursor.S_RESIZE_CURSOR);57c.getType();58c.getName();59c = new Cursor(Cursor.SE_RESIZE_CURSOR);60c.getType();61c.getName();62c = new Cursor(Cursor.SW_RESIZE_CURSOR);63c.getType();64c.getName();65c = new Cursor(Cursor.TEXT_CURSOR);66c.getType();67c.getName();68c = new Cursor(Cursor.W_RESIZE_CURSOR);69c.getType();70c.getName();71c = new Cursor(Cursor.WAIT_CURSOR);72c.getType();73c.getName();7475c = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);76c = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);77c = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);78c = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);79c = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);80c = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);81c = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);82c = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);83c = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);84c = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);85c = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);86c = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);87c = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);88c = Cursor.getDefaultCursor();89c.getType();90c.getName();91}92}939495