modules/fxml/src/test/java/javafx/fxml/FXMLLoader_ScriptTest.java

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization


   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.  Oracle designates this
   9  * particular file as subject to the "Classpath" exception as provided
  10  * by Oracle in the LICENSE file that accompanied this code.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  */
  26 
  27 import com.sun.javafx.fxml.LoadListener;
  28 import org.junit.Test;
  29 
  30 import java.io.IOException;
  31 import java.util.concurrent.atomic.AtomicBoolean;
  32 
  33 import static org.junit.Assert.*;
  34 
  35 public class FXMLLoader_ScriptTest {
  36     @Test
  37     @SuppressWarnings("deprecation")
  38     public void testStaticScriptLoad() throws IOException {
  39         FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("static_script_load.fxml"));
  40         fxmlLoader.impl_setStaticLoad(true);
  41         AtomicBoolean scriptCalled = new AtomicBoolean();
  42         AtomicBoolean scriptEndCalled = new AtomicBoolean();
  43         fxmlLoader.impl_setLoadListener(new LoadListener() {
  44 
  45             @Override
  46             public void readImportProcessingInstruction(String target) {
  47             }
  48 
  49             @Override
  50             public void readLanguageProcessingInstruction(String language) {
  51             }
  52 
  53             @Override
  54             public void readComment(String comment) {
  55             }
  56 
  57             @Override
  58             public void beginInstanceDeclarationElement(Class<?> type) {
  59             }
  60 
  61             @Override
  62             public void beginUnknownTypeElement(String name) {
  63             }




   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.  Oracle designates this
   9  * particular file as subject to the "Classpath" exception as provided
  10  * by Oracle in the LICENSE file that accompanied this code.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  */
  26 

  27 import org.junit.Test;
  28 
  29 import java.io.IOException;
  30 import java.util.concurrent.atomic.AtomicBoolean;
  31 
  32 import static org.junit.Assert.*;
  33 
  34 public class FXMLLoader_ScriptTest {
  35     @Test
  36     @SuppressWarnings("deprecation")
  37     public void testStaticScriptLoad() throws IOException {
  38         FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("static_script_load.fxml"));
  39         fxmlLoader.impl_setStaticLoad(true);
  40         AtomicBoolean scriptCalled = new AtomicBoolean();
  41         AtomicBoolean scriptEndCalled = new AtomicBoolean();
  42         fxmlLoader.setLoadListener(new LoadListener() {
  43 
  44             @Override
  45             public void readImportProcessingInstruction(String target) {
  46             }
  47 
  48             @Override
  49             public void readLanguageProcessingInstruction(String language) {
  50             }
  51 
  52             @Override
  53             public void readComment(String comment) {
  54             }
  55 
  56             @Override
  57             public void beginInstanceDeclarationElement(Class<?> type) {
  58             }
  59 
  60             @Override
  61             public void beginUnknownTypeElement(String name) {
  62             }