/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * 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 2 for more details (a copy is included in the LICENSE file that * 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 contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.netbeans.jemmy.operators; import java.awt.Dimension; import java.awt.Point; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class JInternalFrameOperatorTest { private JFrameOperator frameOper; private JInternalFrameOperator internalFrameOper; @BeforeClass protected void setUp() throws Exception { JFrame frame = new JFrame(); JDesktopPane desktop = new JDesktopPane(); frame.setContentPane(desktop); JInternalFrame internalFrame = new JInternalFrame( "JInternalFrameOperatorTest", true, true, true, true); internalFrame.setName("JInternalFrameOperatorTest"); internalFrame.setSize(200, 200); internalFrame.setVisible(true); desktop.add(internalFrame); frame.setSize(400,400); frame.setLocationRelativeTo(null); frame.setVisible(true); frameOper = new JFrameOperator(); internalFrameOper = new JInternalFrameOperator(frameOper); internalFrameOper.setVerification(true); } @AfterClass protected void tearDown() throws Exception { frameOper.setVisible(false); frameOper.dispose(); } @Test public void testIconify() { internalFrameOper.iconify(); internalFrameOper.deiconify(); } @Test public void testMaximize() { internalFrameOper.maximize(); internalFrameOper.demaximize(); } @Test public void testMove() { Point originalLocation = internalFrameOper.getLocation(); internalFrameOper.move(150, 150); internalFrameOper.move(originalLocation.x, originalLocation.y); } @Test public void testResize() { Dimension originaSize = internalFrameOper.getSize(); internalFrameOper.resize(250, 250); internalFrameOper.resize(originaSize.width, originaSize.height); } @Test public void testActivate() { internalFrameOper.activate(); } }