gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10367: Add some tests for Selection


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10367: Add some tests for Selection.{get, set}Focus().
Date: Thu, 27 Nov 2008 21:39:13 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10367
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2008-11-27 21:39:13 +0100
message:
  Add some tests for Selection.{get,set}Focus().
modified:
  testsuite/actionscript.all/Selection.as
    ------------------------------------------------------------
    revno: 10366.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-11-27 20:10:41 +0100
    message:
      Test for Selection.
    modified:
      testsuite/actionscript.all/Selection.as
=== modified file 'testsuite/actionscript.all/Selection.as'
--- a/testsuite/actionscript.all/Selection.as   2008-03-11 19:31:46 +0000
+++ b/testsuite/actionscript.all/Selection.as   2008-11-27 20:39:13 +0000
@@ -28,6 +28,8 @@
 // Selection was added in SWF5
 //-------------------------------
 
+note("If you click on the window or change focus before or during this test, 
some checks may fail.");
+
 check_equals (typeof(Selection), 'object');
 
 // Selection is an obect, not a class !
@@ -52,6 +54,21 @@
 // test the Selection::setSelection method
 check_equals (typeof(Selection.setSelection), 'function'); 
 
+xcheck_equals(typeof(Selection.getFocus()), "null");
+
+ret = Selection.setFocus();
+xcheck_equals(ret, false);
+
+ret = Selection.setFocus(4);
+xcheck_equals(ret, false);
+
+ret = Selection.setFocus(_root);
+xcheck_equals(ret, false);
+
+ret = Selection.setFocus(_root, 5);
+xcheck_equals(ret, false);
+
+
 // Methods added in version 6
 #if OUTPUT_VERSION >= 6
 
@@ -64,6 +81,54 @@
  xcheck_equals(typeof(Selection._listeners), 'object');
  xcheck(Selection._listeners instanceof Array);
 
+ _root.createEmptyMovieClip("mc", getNextHighestDepth());
+ check(mc instanceof MovieClip);
+ ret = Selection.setFocus(mc);
+ xcheck_equals(ret, false);
+ check_equals(Selection.getFocus(), null);
+
+ mc.createTextField("tx", getNextHighestDepth(), 400, 400, 10, 10);
+
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus(tx);
+ xcheck_equals(typeof(ret), "boolean");
+ xcheck_equals(ret, true);
+
+ // An extra argument when the first argument is valid.
+ ret = Selection.setFocus(tx, 5);
+ xcheck_equals(ret, false);
+ check_equals(Selection.getFocus(), null);
+
+ tx.focusEnabled = true;
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus(tx);
+ xcheck_equals(ret, true);
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus("tx");
+ xcheck_equals(ret, false);
+ check_equals(Selection.getFocus(), null);
+
+ mc.focusEnabled = true;
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus(mc);
+ xcheck_equals(ret, false);
+ xcheck_equals(Selection.getFocus(), "_level0.mc");
+ ret = Selection.setFocus("mc");
+ xcheck_equals(ret, false);
+ xcheck_equals(Selection.getFocus(), "_level0.mc");
+ ret = Selection.setFocus(5);
+ xcheck_equals(ret, false);
+ xcheck_equals(Selection.getFocus(), "_level0.mc");
+
+ Selection.setFocus(tx);
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus("tx");
+ xcheck_equals(ret, false);
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus(tx);
+ xcheck_equals(ret, true);
+ check_equals(Selection.getFocus(), null);
+
 #endif // OUTPUT_VERSION >= 6
 
 totals();


reply via email to

[Prev in Thread] Current Thread [Next in Thread]