You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2012/07/30 18:55:57 UTC

svn commit: r1367170 - in /pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859: ./ Pivot859.java README.txt pivot859.html pivot_859.bxml

Author: smartini
Date: Mon Jul 30 16:55:56 2012
New Revision: 1367170

URL: http://svn.apache.org/viewvc?rev=1367170&view=rev
Log:
PIVOT-859, first version of the test

Added:
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/README.txt
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot859.html
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot_859.bxml

Added: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java?rev=1367170&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java Mon Jul 30 16:55:56 2012
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tests.issues.pivot859;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Window;
+
+/**
+ * Test application , to be run in multiple instances in the same HTML page.
+ */
+public class Pivot859 extends Application.Adapter {
+
+    private Window window = null;
+
+    public void startup(final Display display, Map<String, String> args) throws Exception {
+        System.out.println("Pivot859 startup(...)");
+
+        BXMLSerializer bxmlSerializer = new BXMLSerializer();
+        window = (Window) bxmlSerializer.readObject(Pivot859.class, "pivot_859.bxml");
+        window.open(display);
+    }
+
+    @Override
+    public boolean shutdown(boolean b) throws Exception {
+        if (window != null) {
+            window.close();
+        }
+
+        return false;
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Pivot859.class, args);
+    }
+
+}

Added: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/README.txt
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/README.txt?rev=1367170&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/README.txt (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/README.txt Mon Jul 30 16:55:56 2012
@@ -0,0 +1,12 @@
+//
+// README for Pivot859
+//
+
+This test must be run from a real browser, so before running the test you must generate Pivot jars, with the usual ant commands:
+
+ant package
+and package-tests
+
+Then open the html page here in a real browser.
+
+Note that this test multiple Applet instance inside the same HTML page, and all calls a resource via HTTP.

Added: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot859.html
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot859.html?rev=1367170&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot859.html (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot859.html Mon Jul 30 16:55:56 2012
@@ -0,0 +1,118 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+    <title>Pivot-859 - Test</title>
+
+    <style type="text/css">
+            applet {
+                border: 1px solid #999999;
+            }
+    </style>
+
+</head>
+<body>
+
+<div class="content">
+
+<div class="applet1">
+    <p>Test Applet, first instance</p>
+    <script type="text/javascript" src="http://java.com/js/deployJava.js"></script><script type="text/javascript">
+        var attributes = {
+            id:"applet1",
+            name:"applet, first instance",
+            code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+            width:"640",
+            height:"240"
+        };
+
+        var libraries = [];
+        var pivot_version = "2.0.3";
+        var local_path_to_lib_jars = "../../../../../../../../lib/";
+        libraries.push(local_path_to_lib_jars + "pivot-tests-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-core-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-wtk-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-wtk-terra-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-tutorials-" + pivot_version + ".jar");
+
+        libraries.push(local_path_to_lib_jars + "svgSalamander-tiny.jar");
+
+        attributes.archive = libraries.join(",");
+
+        var parameters = {
+            codebase_lookup:false,
+            application_class_name:'org.apache.pivot.tests.issues.pivot859.Pivot859',
+            separate_jvm:false
+        };
+
+        var javaArguments = ["-Dsun.awt.noerasebackground=true",
+            "-Dsun.awt.erasebackgroundonresize=true"];
+
+        parameters.java_arguments = javaArguments.join(" ");
+
+        deployJava.runApplet(attributes, parameters, "1.6");
+    </script>
+    <br/>
+</div>
+
+
+<div class="applet2">
+    <p>Test Applet, second instance</p>
+    <script type="text/javascript" src="http://java.com/js/deployJava.js"></script><script type="text/javascript">
+        var attributes = {
+            id:"applet2",
+            name:"applet, second instance",
+            code:"org.apache.pivot.wtk.BrowserApplicationContext$HostApplet",
+            width:"640",
+            height:"240"
+        };
+
+        var libraries = [];
+        var pivot_version = "2.0.3";
+        var local_path_to_lib_jars = "../../../../../../../../lib/";
+        libraries.push(local_path_to_lib_jars + "pivot-tests-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-core-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-wtk-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-wtk-terra-" + pivot_version + ".jar");
+        libraries.push(local_path_to_lib_jars + "pivot-tutorials-" + pivot_version + ".jar");
+
+        libraries.push(local_path_to_lib_jars + "svgSalamander-tiny.jar");
+
+        attributes.archive = libraries.join(",");
+
+        var parameters = {
+            codebase_lookup:false,
+            application_class_name:'org.apache.pivot.tests.issues.pivot859.Pivot859',
+            separate_jvm:false
+        };
+
+        var javaArguments = ["-Dsun.awt.noerasebackground=true",
+            "-Dsun.awt.erasebackgroundonresize=true"];
+
+        parameters.java_arguments = javaArguments.join(" ");
+
+        deployJava.runApplet(attributes, parameters, "1.6");
+    </script>
+    <br/>
+</div>
+
+</div>
+
+</body>
+</html>

Added: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot_859.bxml
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot_859.bxml?rev=1367170&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot_859.bxml (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot859/pivot_859.bxml Mon Jul 30 16:55:56 2012
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="Pivot-859" maximized="true"
+    xmlns:bxml="http://pivot.apache.org/bxml"
+    xmlns:app="org.apache.pivot.tests.issues"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk"
+>
+
+    <TablePane styles="{padding:6, horizontalSpacing:6, verticalSpacing:8}">
+        <columns>
+            <TablePane.Column width="100"/>
+            <TablePane.Column width="1*"/>
+            <TablePane.Column width="50"/>
+        </columns>
+
+        <TablePane.Row height="-1">
+            <Label styles="{horizontalAlignment:'right', verticalAlignment:'center'}" text="URL:"/>
+            <TextInput bxml:id="textInput" text="http://pivot.apache.org/index.html" textSize="30"/>
+            <PushButton buttonData="Go">
+                <buttonPressListeners>
+                function buttonPressed(button) {
+                    var id = "";  
+                        // = org.apache.pivot.wtk.BrowserApplicationContext.eval("", Pivot859.this);  // test
+                    java.lang.System.out.println("Applet " + id + ", getting content from \"" + textInput.text + "\" ...");
+                    textArea.text = "";
+                }
+                </buttonPressListeners>
+            </PushButton>
+        </TablePane.Row>
+        <TablePane.Row height="-1">
+            <Label styles="{horizontalAlignment:'right', verticalAlignment:'center'}" text="Content:"/>
+            <Border>
+                <TextArea bxml:id="textArea" text="" preferredWidth="320" preferredHeight="200" styles="{wrapText:true}">
+                   <textAreaContentListeners>
+                    function textChanged(textArea) {
+                        // java.lang.System.out.println("length = " + textArea.characterCount);
+                    }
+                    </textAreaContentListeners>
+                </TextArea>
+            </Border>
+            <PushButton buttonData="Clear" preferredHeight="40" preferredWidth="50">
+                <buttonPressListeners>
+                function buttonPressed(button) {
+                    textArea.text = "";
+                }
+                </buttonPressListeners>
+            </PushButton>
+        </TablePane.Row>
+    </TablePane>
+
+</Window>