Updated tests to reflect current VF2JS output.

Signed-off-by: Erik de Bruin <e...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/50517db6
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/50517db6
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/50517db6

Branch: refs/heads/develop
Commit: 50517db642065c0e66aca39fd58ef22a1b9993b3
Parents: b568782
Author: Erik de Bruin <e...@ixsoftware.nl>
Authored: Thu Jul 31 16:17:42 2014 +0200
Committer: Erik de Bruin <e...@ixsoftware.nl>
Committed: Fri Aug 1 12:59:16 2014 +0200

----------------------------------------------------------------------
 .../codegen/js/vf2js/TestVF2JSProject.java      | 12 +---
 .../mxml/vf2js/TestVF2JSMXMLApplication.java    |  2 +-
 .../flex/compiler/internal/test/TestBase.java   |  3 -
 .../compiler/internal/test/VF2JSTestBase.java   | 50 ++++++++-----
 .../test-files/vf2js/files/SimpleAS_result.js   |  2 +-
 .../test-files/vf2js/files/SimpleMXML.mxml      | 10 +--
 .../test-files/vf2js/files/SimpleMXML_result.js | 74 +++++---------------
 7 files changed, 57 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
index 282bf19..38c21c8 100644
--- 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
+++ 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
@@ -25,10 +25,9 @@ import static org.junit.Assert.assertThat;
 import java.io.File;
 import java.util.List;
 
-import org.apache.flex.compiler.driver.IBackend;
-import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.test.VF2JSTestBase;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -48,6 +47,7 @@ public class TestVF2JSProject extends VF2JSTestBase
         super.setUp();
     }
 
+    @Ignore
     @Test
     public void testSimpleMXMLProject()
     {
@@ -61,12 +61,6 @@ public class TestVF2JSProject extends VF2JSTestBase
         assertProjectOut(compiledFileNames, testDirPath);
     }
 
-    @Override
-    protected IBackend createBackend()
-    {
-        return new MXMLFlexJSBackend();
-    }
-
     protected void assertProjectOut(List<String> compiledFileNames,
             String testDirPath)
     {
@@ -78,7 +72,7 @@ public class TestVF2JSProject extends VF2JSTestBase
                     + backend.getOutputExtension();
             String compiledResult = readCodeFile(new File(compiledFilePath));
 
-            //System.out.println(compiledResult);
+            System.out.println(compiledResult);
             
             String expectedFilePath = testDirPath + File.separator
                     + compiledFileName + "_result" + "."

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java
 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java
index 27b7f78..9e8e17b 100644
--- 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java
+++ 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLApplication.java
@@ -35,7 +35,7 @@ public class TestVF2JSMXMLApplication extends VF2JSTestBase
 
         mxmlBlockWalker.visitFile(node);
         
-        //writeResultToFile(writer.toString(), fileName);
+        //writeResultToFile(writer.toxString(), fileName);
 
         assertOut(getCodeFromFile(fileName + "_result", true, "vf2js/files"));
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
index 3cf4091..2a2e90b 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
@@ -135,9 +135,6 @@ public class TestBase implements ITestBase
     {
         backend = null;
         writer = null;
-        asEmitter = null;
-        asBlockWalker = null;
-        mxmlBlockWalker = null;
     }
 
     protected IBackend createBackend()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
index de0ba6d..8ec44e6 100644
--- 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
+++ 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/VF2JSTestBase.java
@@ -30,7 +30,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.flex.compiler.config.Configurator;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.codegen.as.ASFilterWriter;
-import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
+import org.apache.flex.compiler.internal.driver.mxml.vf2js.MXMLVF2JSBackend;
 import org.apache.flex.compiler.internal.mxml.MXMLNamespaceMapping;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.targets.JSTarget;
@@ -57,6 +57,24 @@ public class VF2JSTestBase extends TestBase
         project = new FlexJSProject(workspace);
         
         super.setUp();
+
+        asEmitter = backend.createEmitter(writer);
+        mxmlEmitter = backend.createMXMLEmitter(writer);
+
+        asBlockWalker = backend.createWalker(project, errors, asEmitter);
+        mxmlBlockWalker = backend.createMXMLWalker(project, errors,
+                mxmlEmitter, asEmitter, asBlockWalker);
+    }
+
+    @Override
+    public void tearDown()
+    {
+        asEmitter = null;
+        asBlockWalker = null;
+        mxmlEmitter = null;
+        mxmlBlockWalker = null;
+        
+        super.tearDown();
     }
 
     @Override
@@ -109,7 +127,7 @@ public class VF2JSTestBase extends TestBase
     @Override
     protected IBackend createBackend()
     {
-        return new MXMLFlexJSBackend();
+        return new MXMLVF2JSBackend();
     }
     
     @Override
@@ -206,8 +224,8 @@ public class VF2JSTestBase extends TestBase
 
                 ASFilterWriter outputWriter = 
backend.createWriterBuffer(project);
 
-                asEmitter = backend.createEmitter(outputWriter);
-                asBlockWalker = backend.createWalker(project, errors, 
asEmitter);
+                //asEmitter = backend.createEmitter(outputWriter);
+                //asBlockWalker = backend.createWalker(project, errors, 
asEmitter);
 
                 if (cuType == ICompilationUnit.UnitType.AS_UNIT)
                 {
@@ -215,15 +233,15 @@ public class VF2JSTestBase extends TestBase
                 }
                 else
                 {
-                    mxmlEmitter = backend.createMXMLEmitter(outputWriter);
+                    //mxmlEmitter = backend.createMXMLEmitter(outputWriter);
                     
-                    mxmlBlockWalker = backend.createMXMLWalker(project, errors,
-                            mxmlEmitter, asEmitter, asBlockWalker);
+                    //mxmlBlockWalker = backend.createMXMLWalker(project, 
errors,
+                    //        mxmlEmitter, asEmitter, asBlockWalker);
 
                     mxmlBlockWalker.visitCompilationUnit(cu);
                 }
                 
-                //System.out.println(outputWriter.toString());
+                System.out.println(outputWriter.toString());
 
                 try
                 {
@@ -239,12 +257,6 @@ public class VF2JSTestBase extends TestBase
                     System.out.println(error);
                 }
                 
-                mxmlBlockWalker = null;
-                mxmlEmitter = null;
-                
-                asBlockWalker = null;
-                asEmitter = null;
-                
                 outputWriter = null;
             }
         }
@@ -263,15 +275,15 @@ public class VF2JSTestBase extends TestBase
             int wrapLevel)
     {
         if (wrapLevel >= WRAP_LEVEL_NODE)
-            code = "<vf2js_s:Button " + code + "></vf2js_s:Button>";
+            code = "<s:Button " + code + "></s:Button>";
 
         if (wrapLevel >= WRAP_LEVEL_DOCUMENT)
             code = ""
-                    + "<vf2js_s:Application 
xmlns:fx=\"http://ns.adobe.com/mxml/2009\"\n";
-                    + "                     
xmlns:vf2js_mx=\"http://flex.apache.org/vf2js_mx/ns\";>\n"
-                    + "                     
xmlns:vf2js_s=\"http://flex.apache.org/vf2js_s/ns\";>\n"
+                    + "<s:Application 
xmlns:fx=\"http://ns.adobe.com/mxml/2009\"";
+                    + "               
xmlns:s=\"library://ns.adobe.com/flex/spark\"" 
+                    + "               
xmlns:mx=\"library://ns.adobe.com/flex/mx\">\n"
                     + code + "\n"
-                    + "</vf2js_s:Application>";
+                    + "</s:Application>";
         
         File intermediateFile = writeCodeToTempFile(code, false, "");
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js 
b/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
index 5bdb09a..a063d87 100644
--- a/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
+++ b/compiler.jx.tests/test-files/vf2js/files/SimpleAS_result.js
@@ -29,7 +29,7 @@ goog.provide('org.apache.flex.A');
  * @implements {flash.events.IEventDispatcher}
  */
 org.apache.flex.A = function() {
-  goog.base(this);
+  org.apache.flex.A.base(this, 'constructor');
   org.apache.flex.utils.Language.trace(typeof("a"));
 };
 goog.inherits(org.apache.flex.A, vf2js_s.components.Button);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/test-files/vf2js/files/SimpleMXML.mxml
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/files/SimpleMXML.mxml 
b/compiler.jx.tests/test-files/vf2js/files/SimpleMXML.mxml
index 2494f9a..477b353 100644
--- a/compiler.jx.tests/test-files/vf2js/files/SimpleMXML.mxml
+++ b/compiler.jx.tests/test-files/vf2js/files/SimpleMXML.mxml
@@ -1,9 +1,9 @@
-<vf2js_s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
-                     xmlns:vf2js_mx="http://flex.apache.org/vf2js_mx/ns";
-                     xmlns:vf2js_s="http://flex.apache.org/vf2js_s/ns";
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
+               xmlns:s="library://ns.adobe.com/flex/spark"
+               xmlns:mx="library://ns.adobe.com/flex/mx">
 
-  <vf2js_mx:Button invalidAttr="nope" />
+  <s:Button label="hello" x="100" />
 
-  <vf2js_s:Button label="hello" x="100" invalidAttr="nope" />
+  <s:Button label="bye" x="200" />
 
 </vf2js_s:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/50517db6/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js 
b/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
index cbcbcb3..1a20d8a 100644
--- a/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
+++ b/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
@@ -22,7 +22,6 @@
 goog.provide('SimpleMXML');
 
 goog.require('vf2js_s.components.Application');
-goog.require('vf2js_mx.components.Button');
 goog.require('vf2js_s.components.Button');
 
 
@@ -33,31 +32,19 @@ goog.require('vf2js_s.components.Button');
  * @extends {vf2js_s.components.Application}
  */
 SimpleMXML = function() {
-  goog.base(this);
+  SimpleMXML.base(this, 'constructor');
   
   /**
    * @private
-   * @type {vf2js_mx.components.Button}
+   * @type {vf2js_s.components.Button}
    */
   this.$ID0;
-  
+
   /**
    * @private
    * @type {vf2js_s.components.Button}
    */
   this.$ID1;
-  
-  /**
-   * @private
-   * @type {Array}
-   */
-  this.mxmldd;
-  
-  /**
-   * @private
-   * @type {Array}
-   */
-  this.mxmldp;
 };
 goog.inherits(SimpleMXML, vf2js_s.components.Application);
 
@@ -71,48 +58,19 @@ SimpleMXML.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 
'SimpleMXML', qName:
 
 
 /**
- * @override
- * @return {Array} the Array of UI element descriptors.
+ * start
+ *
+ * @expose
  */
-SimpleMXML.prototype.get_MXMLProperties = function()
-{
-  if (this.mxmldp == undefined)
-  {
-    /** @type {Array} */
-    var arr = goog.base(this, 'get_MXMLProperties');
-    /** @type {Array} */
-    var data = [
-2,
-vf2js_mx.components.Button,
-1,
-'_id',
-true,
-'$ID0',
-0,
-0,
-null,
-vf2js_s.components.Button,
-3,
-'_id',
-true,
-'$ID1',
-'label',
-true,
-'hello',
-'x',
-true,
-100,
-0,
-0,
-null0,
-0
-];
-  
-    if (arr)
-      this.mxmldp = arr.concat(data);
-    else
-      this.mxmldp = data;
-  }
-  return this.mxmldp;
+SimpleMXML.prototype.start = function () {
+this.$ID0 = new vf2js_s.components.Button();
+this.$ID0.label = 'hello';
+this.$ID0.x = 100;
+this.$ID0.render();
+this.$ID1 = new vf2js_s.components.Button();
+this.$ID1.label = 'bye';
+this.$ID1.x = 200;
+this.$ID1.render();
+
 };
 

Reply via email to