Migrate CompositionTest class to FU 4
Remove some unused imports

Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/0d5ac0c1
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/0d5ac0c1
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/0d5ac0c1

Branch: refs/heads/develop
Commit: 0d5ac0c125ac5bcb5758ff1e008a394ad7cd0d55
Parents: db39b65
Author: piotrz <[email protected]>
Authored: Mon Jun 2 23:14:56 2014 +0200
Committer: piotrz <[email protected]>
Committed: Mon Jun 2 23:14:56 2014 +0200

----------------------------------------------------------------------
 .../UnitTest/ExtendedClasses/VellumTestCase.as  |    2 +-
 .../src/UnitTest/Fixtures/FileRepository.as     |  483 +++--
 .../src/UnitTest/Fixtures/TestEditManager.as    |    1 -
 automation_tests/src/AllTestsSuite.as           |    9 +-
 .../src/UnitTest/Tests/CompositionTest.as       | 1843 +++++++++---------
 .../src/UnitTest/Tests/ContainerTypeTest.as     |   98 +-
 6 files changed, 1263 insertions(+), 1173 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/0d5ac0c1/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as
----------------------------------------------------------------------
diff --git a/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as 
b/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as
index 426563f..520ec6a 100644
--- a/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as
+++ b/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as
@@ -126,7 +126,7 @@ package UnitTest.ExtendedClasses
 
         public function VellumTestCase(methodName:String = null, testID:String 
= null, testConfig:TestConfig = null, testCaseXML:XML = null)
         {
-            TestData = new Object();
+            TestData = {};
 
             // set defaults to some items in TestData - these can be overridden
             // in a specific test case's constructor or in an XML file

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/0d5ac0c1/automation_core/src/UnitTest/Fixtures/FileRepository.as
----------------------------------------------------------------------
diff --git a/automation_core/src/UnitTest/Fixtures/FileRepository.as 
b/automation_core/src/UnitTest/Fixtures/FileRepository.as
index 55830f4..b83d8d2 100644
--- a/automation_core/src/UnitTest/Fixtures/FileRepository.as
+++ b/automation_core/src/UnitTest/Fixtures/FileRepository.as
@@ -18,259 +18,254 @@
 
////////////////////////////////////////////////////////////////////////////////
 package UnitTest.Fixtures
 {
-       import flash.events.Event;
-       import flash.events.IOErrorEvent;
-       import flash.events.SecurityErrorEvent;
-       import flash.net.URLLoader;
-       import flash.net.URLRequest;
-       import flash.net.URLRequestMethod;
+    import flash.net.URLLoader;
+    import flash.net.URLRequest;
+    import flash.net.URLRequestMethod;
 
     import mx.utils.LoaderUtil;
 
-       /** Gateway class for reading and caching files used by the test 
harness code.
-        */
-       public class FileRepository
-       {
-               /** Get the named file.
-                * @param       fileName name of the file we're looking for
-                * @return String that contains the content of the file
-                */
-               static public function getFile(baseURL:String, 
fileName:String):String
-               {
-                       return 
CustomURLLoader.getFile(LoaderUtil.createAbsoluteURL(baseURL,fileName));
-               }
-
-               /** Get the named file as an XML object.
-                * File will be converted assuming whitespace is significant.
-                * @param       fileName of the file we're looking for
-                * @return String that contains the content of the file
-                */
-               static public function getFileAsXML(baseURL:String, 
fileName:String):XML
-               {
-                       var xmlData:XML = null;
-                       var sourceString:String = getFile(baseURL,fileName);
-                       return sourceString ? convertToXML(sourceString) : null;
-               }
-
-               /** Convert from string to XML */
-               static private function convertToXML(sourceString:String):XML
-               {
-                       var xmlData:XML = null;
-
-                       // Convert string data to XML
-                       var originalSettings:Object = XML.settings();
-                       try
-                       {
-                               XML.ignoreProcessingInstructions = false;
-                               XML.ignoreWhitespace = false;
-                               xmlData = new XML(sourceString);
-                       }
-                       finally
-                       {
-                               XML.setSettings(originalSettings);
-                       }
-                       return xmlData;
-               }
-
-               /**
-               * Reads in a file and set up a handler for when the file read 
is complete
-               */
-               static public function readFile(baseURL:String, 
fileName:String, handler:Function = null, errorHandler:Function = null, 
securityHandler:Function = null, ignoreWhitespace:Boolean = false): void
-               {
-                       if (fileName == null || fileName.length <= 0)
-                               return;
-
-                       var tcURL:URLRequest = new 
URLRequest(LoaderUtil.createAbsoluteURL(baseURL,fileName));
-                       tcURL.method = URLRequestMethod.GET;
-                       var tcLoader:URLLoader = new CustomURLLoader(handler, 
errorHandler, securityHandler);
-                       tcLoader.load(tcURL);
-               }
-
-       /**
-        * Returns true if there are pending requests, false if not
-        */
-        static public function pendingRequests(): Boolean
+    /** Gateway class for reading and caching files used by the test harness 
code.
+     */
+    public class FileRepository
+    {
+        /** Get the named file.
+         * @param    fileName name of the file we're looking for
+         * @return String that contains the content of the file
+         */
+        static public function getFile(baseURL:String, fileName:String):String
+        {
+            return 
CustomURLLoader.getFile(LoaderUtil.createAbsoluteURL(baseURL, fileName));
+        }
+
+        /** Get the named file as an XML object.
+         * File will be converted assuming whitespace is significant.
+         * @param    fileName of the file we're looking for
+         * @return String that contains the content of the file
+         */
+        static public function getFileAsXML(baseURL:String, 
fileName:String):XML
+        {
+            var xmlData:XML = null;
+            var sourceString:String = getFile(baseURL, fileName);
+            return sourceString ? convertToXML(sourceString) : null;
+        }
+
+        /** Convert from string to XML */
+        static private function convertToXML(sourceString:String):XML
+        {
+            var xmlData:XML = null;
+
+            // Convert string data to XML
+            var originalSettings:Object = XML.settings();
+            try
+            {
+                XML.ignoreProcessingInstructions = false;
+                XML.ignoreWhitespace = false;
+                xmlData = new XML(sourceString);
+            }
+            finally
+            {
+                XML.setSettings(originalSettings);
+            }
+            return xmlData;
+        }
+
+        /**
+         * Reads in a file and set up a handler for when the file read is 
complete
+         */
+        static public function readFile(baseURL:String, fileName:String, 
handler:Function = null, errorHandler:Function = null, securityHandler:Function 
= null, ignoreWhitespace:Boolean = false):void
+        {
+            if (fileName == null || fileName.length <= 0)
+                return;
+
+            var tcURL:URLRequest = new 
URLRequest(LoaderUtil.createAbsoluteURL(baseURL, fileName));
+            tcURL.method = URLRequestMethod.GET;
+            var tcLoader:URLLoader = new CustomURLLoader(handler, 
errorHandler, securityHandler);
+            tcLoader.load(tcURL);
+        }
+
+        /**
+         * Returns true if there are pending requests, false if not
+         */
+        static public function pendingRequests():Boolean
         {
             return (CustomURLLoader.requestsPending != 0);
         }
-       }
+    }
 }
-       import flash.net.URLLoader;
-       import flash.net.URLRequest;
-       import flash.events.Event;
-       import flash.events.SecurityErrorEvent;
-       import flash.events.IOErrorEvent;
-       import flashx.textLayout.debug.assert;
 
-import org.flexunit.asserts.assertEquals;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLLoader;
+import flash.net.URLRequest;
 
 /** Serves as a single bottleneck for all requests that go through
-        * FileRepository. Requests come in as URLLoader.load calls, and we
-        * always listen for completion, error, and security error. If a handler
-        * for any of these is passed in when the CustomURLLoader is 
constructed,
-        * we will in addition call the handler.
-        *
-        * Override URLLoader so we can get the request back when we're
-        * in a completion function. Also tracks outstanding requests so we
-        * can block until results are complete.
-        */
-       class CustomURLLoader extends URLLoader
-       {
-               public var request: URLRequest;                 // original 
request for file load
-               public var completeHandler:Function;    // custom completion 
handler
-               public var ioErrorHandler:Function;             // custom i/o 
error handler
-               public var securityErrorHandler:Function;       // custom 
security error handler
-
-               /** Cache containing all files that have been requested.
-                * The key is the name of the file as given in the original 
request, and the
-                * value is the contents of the file as a string. */
-               static private var _fileCache:Object;
-
-               /** Number of file read requests that are pending -- i.e., that 
have neither
-                * completed successfully nor returned errors.
-                */
-               static private var _requestsPending:int = 0;
-
-               static private var FILE_ERROR:String = "$$$NOT_FOUNDXXX" // 
unique string to signal file read error
-
-               /** Constructor
-                * Note that if you specify all three handlers, one will be 
called depending on the outcome of the
-                * read.
-                *
-                * @param completeHandler - custom handler called on successful 
completion of file read
-                * @param ioErrorHandler - custom handler called on i/o error 
of file read
-                * @param securityErrorHandler - custom handler called on 
security error of file read
-                */
-               public function CustomURLLoader(completeHandler:Function, 
ioErrorHandler:Function = null, securityErrorHandler:Function = null)
-               {
-                       this.completeHandler = completeHandler;
-                       this.ioErrorHandler = ioErrorHandler;
-                       this.securityErrorHandler = securityErrorHandler;
-
-                       if (!_fileCache)
-                               _fileCache = new Object();
-               }
-
-               /** Returns number of file read requests that are pending -- 
i.e., that have neither
-                * completed successfully nor returned errors.
-                */
-               static public function get requestsPending():int
-               {
-                       return _requestsPending;
-               }
-
-               /** Given the name of a file, look it up in the cache and 
return the contents as a string. */
-               static public function getFile(fileName:String):String
-               {
-                       // If it's in the cache, just return it
-                       if (_fileCache[fileName] != null)
-                               return _fileCache[fileName];
-
-                       // We have a request out, and we're waiting for the 
result. Unfortunately, there's no
-                       // way we know to wait and still handle the events that 
would cause the pending status
-                       // to complete. So we return failure here as well.
-                       if (_fileCache.hasOwnProperty(fileName))
-                               return null;
-
-                       // We've never seen this file
-                       return null;
-               }
-
-               /** Add a new file to the cache. Takes the name of the file, as 
given in the URLRequest,
-                * and the file contents as a string. */
-               static private function addToCache(urlLoader:CustomURLLoader, 
data:String):void
-               {
-
-                       //CONFIG::debug { 
assertEquals(_fileCache[getFileKey(urlLoader)] == null, "Adding over existing 
cache entry!"); }
-                       _fileCache[getFileKey(urlLoader)] = data;
-               }
-
-               /** Default handler. This will get called on every successful 
completion of a read that goes
-                * through CustomURLLoader. It's job is to add the file to the 
file cache, and call the
-                * custom completion handler, if one was specified.
-                */
-               static private function defaultCompleteHandler(event:Event):void
-               {
-                       // Remove the event listener that was attached so this 
function could get called.
-                       if (event)
-                               
event.target.removeEventListener(Event.COMPLETE, defaultCompleteHandler);
-
-                       // This request handled; is no longer pending
-                       --_requestsPending;
-
-                       // Add the new file to the cache
-                       var urlLoader:CustomURLLoader = 
CustomURLLoader(event.target);
-                       addToCache(urlLoader, urlLoader.data);
-
-                       // Call the custom completion handler
-                       if (urlLoader.completeHandler != null)
-                               urlLoader.completeHandler(event);
-                       urlLoader.close();
-               }
-
-               /** Default handler. This will get called on every security 
error of a read that goes
-                * through CustomURLLoader. It's job is to update the file 
cache, and call the
-                * custom security error handler, if one was specified.
-                */
-               static private function 
defaultSecurityErrorHandler(event:SecurityErrorEvent):void
-               {
-                       if (event)
-                               
event.target.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, 
defaultSecurityErrorHandler);
-
-                       --_requestsPending;
-                       var urlLoader:CustomURLLoader = 
CustomURLLoader(event.target);
-                       addToCache(urlLoader, FILE_ERROR);
-                       if (urlLoader.securityErrorHandler != null)
-                               urlLoader.securityErrorHandler(event);
+ * FileRepository. Requests come in as URLLoader.load calls, and we
+ * always listen for completion, error, and security error. If a handler
+ * for any of these is passed in when the CustomURLLoader is constructed,
+ * we will in addition call the handler.
+ *
+ * Override URLLoader so we can get the request back when we're
+ * in a completion function. Also tracks outstanding requests so we
+ * can block until results are complete.
+ */
+class CustomURLLoader extends URLLoader
+{
+    public var request:URLRequest;                     // original request for 
file load
+    public var completeHandler:Function;       // custom completion handler
+    public var ioErrorHandler:Function;                // custom i/o error 
handler
+    public var securityErrorHandler:Function;  // custom security error handler
+
+    /** Cache containing all files that have been requested.
+     * The key is the name of the file as given in the original request, and 
the
+     * value is the contents of the file as a string. */
+    static private var _fileCache:Object;
+
+    /** Number of file read requests that are pending -- i.e., that have 
neither
+     * completed successfully nor returned errors.
+     */
+    static private var _requestsPending:int = 0;
+
+    static private var FILE_ERROR:String = "$$$NOT_FOUNDXXX" // unique string 
to signal file read error
+
+    /** Constructor
+     * Note that if you specify all three handlers, one will be called 
depending on the outcome of the
+     * read.
+     *
+     * @param completeHandler - custom handler called on successful completion 
of file read
+     * @param ioErrorHandler - custom handler called on i/o error of file read
+     * @param securityErrorHandler - custom handler called on security error 
of file read
+     */
+    public function CustomURLLoader(completeHandler:Function, 
ioErrorHandler:Function = null, securityErrorHandler:Function = null)
+    {
+        this.completeHandler = completeHandler;
+        this.ioErrorHandler = ioErrorHandler;
+        this.securityErrorHandler = securityErrorHandler;
+
+        if (!_fileCache)
+            _fileCache = new Object();
+    }
+
+    /** Returns number of file read requests that are pending -- i.e., that 
have neither
+     * completed successfully nor returned errors.
+     */
+    static public function get requestsPending():int
+    {
+        return _requestsPending;
+    }
+
+    /** Given the name of a file, look it up in the cache and return the 
contents as a string. */
+    static public function getFile(fileName:String):String
+    {
+        // If it's in the cache, just return it
+        if (_fileCache[fileName] != null)
+            return _fileCache[fileName];
+
+        // We have a request out, and we're waiting for the result. 
Unfortunately, there's no
+        // way we know to wait and still handle the events that would cause 
the pending status
+        // to complete. So we return failure here as well.
+        if (_fileCache.hasOwnProperty(fileName))
+            return null;
+
+        // We've never seen this file
+        return null;
+    }
+
+    /** Add a new file to the cache. Takes the name of the file, as given in 
the URLRequest,
+     * and the file contents as a string. */
+    static private function addToCache(urlLoader:CustomURLLoader, 
data:String):void
+    {
+
+        //CONFIG::debug { assertEquals(_fileCache[getFileKey(urlLoader)] == 
null, "Adding over existing cache entry!"); }
+        _fileCache[getFileKey(urlLoader)] = data;
+    }
+
+    /** Default handler. This will get called on every successful completion 
of a read that goes
+     * through CustomURLLoader. It's job is to add the file to the file cache, 
and call the
+     * custom completion handler, if one was specified.
+     */
+    static private function defaultCompleteHandler(event:Event):void
+    {
+        // Remove the event listener that was attached so this function could 
get called.
+        if (event)
+            event.target.removeEventListener(Event.COMPLETE, 
defaultCompleteHandler);
+
+        // This request handled; is no longer pending
+        --_requestsPending;
+
+        // Add the new file to the cache
+        var urlLoader:CustomURLLoader = CustomURLLoader(event.target);
+        addToCache(urlLoader, urlLoader.data);
+
+        // Call the custom completion handler
+        if (urlLoader.completeHandler != null)
+            urlLoader.completeHandler(event);
+        urlLoader.close();
+    }
+
+    /** Default handler. This will get called on every security error of a 
read that goes
+     * through CustomURLLoader. It's job is to update the file cache, and call 
the
+     * custom security error handler, if one was specified.
+     */
+    static private function 
defaultSecurityErrorHandler(event:SecurityErrorEvent):void
+    {
+        if (event)
+            
event.target.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, 
defaultSecurityErrorHandler);
+
+        --_requestsPending;
+        var urlLoader:CustomURLLoader = CustomURLLoader(event.target);
+        addToCache(urlLoader, FILE_ERROR);
+        if (urlLoader.securityErrorHandler != null)
+            urlLoader.securityErrorHandler(event);
+    }
+
+    /** Default handler. This will get called on every i/o error of a read 
that goes
+     * through CustomURLLoader. It's job is to update the file cache, and call 
the
+     * custom i/o error handler, if one was specified.
+     */
+    static private function defaultIOErrorHandler(event:IOErrorEvent):void
+    {
+        if (event)
+            event.target.removeEventListener(IOErrorEvent.IO_ERROR, 
defaultIOErrorHandler);
+
+        --_requestsPending;
+        var urlLoader:CustomURLLoader = CustomURLLoader(event.target);
+        addToCache(urlLoader, FILE_ERROR);
+        if (urlLoader.ioErrorHandler != null)
+            urlLoader.ioErrorHandler(event);
+    }
+
+    /* Start a file read.
+     * @param request - URL request for the read
+     */
+    override public function load(request:URLRequest):void
+    {
+        this.request = request;
+
+        // If we have already read this file in, or we are already in the 
middle of reading it in, don't make another request
+        if (_fileCache.hasOwnProperty(getFileKey(this)))
+        {
+            //CONFIG::debug { assert (completeHandler == null, "Load has file 
cached, won't be calling completeHandler! You should call get() before calling 
readFile()"); }
+            return;
         }
 
-               /** Default handler. This will get called on every i/o error of 
a read that goes
-                * through CustomURLLoader. It's job is to update the file 
cache, and call the
-                * custom i/o error handler, if one was specified.
-                */
-        static private function defaultIOErrorHandler(event:IOErrorEvent):void
-        {
-                       if (event)
-                               
event.target.removeEventListener(IOErrorEvent.IO_ERROR, defaultIOErrorHandler);
-
-               --_requestsPending;
-                       var urlLoader:CustomURLLoader = 
CustomURLLoader(event.target);
-                       addToCache(urlLoader, FILE_ERROR);
-                       if (urlLoader.ioErrorHandler != null)
-                               urlLoader.ioErrorHandler(event);
-         }
-
-        /* Start a file read.
-         * @param request - URL request for the read
-         */
-               override public function load(request:URLRequest):void
-               {
-                       this.request = request;
-
-                       // If we have already read this file in, or we are 
already in the middle of reading it in, don't make another request
-                       if (_fileCache.hasOwnProperty(getFileKey(this)))
-                       {
-                               //CONFIG::debug { assert (completeHandler == 
null, "Load has file cached, won't be calling completeHandler! You should call 
get() before calling readFile()"); }
-                               return;
-                       }
-
-                       // Add it to the cache as a null entry, to signal 
there's a request pending on it
-                       _fileCache[getFileKey(this)] = null;
-
-                       // Attach listeners so the default handlers get called.
-                       addEventListener(Event.COMPLETE,defaultCompleteHandler, 
false, 0, true);
-                       
addEventListener(SecurityErrorEvent.SECURITY_ERROR,defaultSecurityErrorHandler, 
false, 0, true);
-                       addEventListener(IOErrorEvent.IO_ERROR, 
defaultIOErrorHandler, false, 0, true);
-
-                       ++_requestsPending;
-                       super.load(request);
-               }
-
-               /** Given a URLLoader, return the key for access the file 
cache. Right now, we
-                * just use the file name for this.
-                */
-               static private function 
getFileKey(urlLoader:CustomURLLoader):String
-               {
-                       return urlLoader.request.url;
-               }
-       }
+        // Add it to the cache as a null entry, to signal there's a request 
pending on it
+        _fileCache[getFileKey(this)] = null;
+
+        // Attach listeners so the default handlers get called.
+        addEventListener(Event.COMPLETE, defaultCompleteHandler, false, 0, 
true);
+        addEventListener(SecurityErrorEvent.SECURITY_ERROR, 
defaultSecurityErrorHandler, false, 0, true);
+        addEventListener(IOErrorEvent.IO_ERROR, defaultIOErrorHandler, false, 
0, true);
+
+        ++_requestsPending;
+        super.load(request);
+    }
+
+    /** Given a URLLoader, return the key for access the file cache. Right 
now, we
+     * just use the file name for this.
+     */
+    static private function getFileKey(urlLoader:CustomURLLoader):String
+    {
+        return urlLoader.request.url;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/0d5ac0c1/automation_core/src/UnitTest/Fixtures/TestEditManager.as
----------------------------------------------------------------------
diff --git a/automation_core/src/UnitTest/Fixtures/TestEditManager.as 
b/automation_core/src/UnitTest/Fixtures/TestEditManager.as
index 6d9cf7f..00627d4 100644
--- a/automation_core/src/UnitTest/Fixtures/TestEditManager.as
+++ b/automation_core/src/UnitTest/Fixtures/TestEditManager.as
@@ -20,7 +20,6 @@ package UnitTest.Fixtures
 {
        import flashx.textLayout.conversion.ConversionType;
        import flashx.textLayout.conversion.ITextExporter;
-       import flashx.textLayout.conversion.ITextImporter;
        import flashx.textLayout.conversion.TextConverter;
        import flashx.textLayout.edit.EditManager;
        import flashx.textLayout.operations.FlowOperation;

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/0d5ac0c1/automation_tests/src/AllTestsSuite.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/AllTestsSuite.as 
b/automation_tests/src/AllTestsSuite.as
index eae5aa2..cd41709 100644
--- a/automation_tests/src/AllTestsSuite.as
+++ b/automation_tests/src/AllTestsSuite.as
@@ -26,6 +26,7 @@ package
     import UnitTest.Tests.AllParaAttributeTest;
     import UnitTest.Tests.AttributeTest;
     import UnitTest.Tests.BoxTest;
+    import UnitTest.Tests.CompositionTest;
     import UnitTest.Tests.ContainerTypeTest;
     import UnitTest.Tests.FloatTest;
     import UnitTest.Tests.OperationTest;
@@ -36,16 +37,18 @@ package
     public dynamic class AllTestsSuite
     {
         public var accessibilityMethodsTest:AccessibilityMethodsTest;
+        public var compositionTest:CompositionTest;
+        public var allChartAttributeTest:AllCharAttributeTest;
+        public var allContAttirbuteTest:AllContAttributeTest;
         public var allEventTest:AllEventTest;
+        public var allParagraphAttributeTest:AllParaAttributeTest;
         public var attributeTest:AttributeTest;
         public var boxTest:BoxTest;
         public var containerTypeTest:ContainerTypeTest;
         public var floatTest:FloatTest;
         public var operationTest:OperationTest;
         public var scrollingTest:ScrollingTest;
-        public var allChartAttributeTest:AllCharAttributeTest;
-        public var allParagraphAttributeTest:AllParaAttributeTest;
-        public var allContAttirbuteTest:AllContAttributeTest;
+
     }
 
 }

Reply via email to