gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12276: Add some simple tests for co


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12276: Add some simple tests for color transform, including interaction of
Date: Tue, 29 Jun 2010 13:01:12 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12276 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2010-06-29 13:01:12 +0200
message:
  Add some simple tests for color transform, including interaction of
  MovieClip.transform and the Color class. Drop "user cxform" of MovieClip,
  fixing both old and new tests.
modified:
  libcore/MovieClip.cpp
  libcore/MovieClip.h
  libcore/asobj/Color_as.cpp
  testsuite/actionscript.all/Color.as
  testsuite/actionscript.all/Transform.as
  testsuite/swfdec/PASSING
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2010-06-23 06:12:47 +0000
+++ b/libcore/MovieClip.cpp     2010-06-29 10:09:45 +0000
@@ -2144,7 +2144,6 @@
 MovieClip::get_world_cxform() const
 {
     cxform cf = DisplayObject::get_world_cxform();
-    cf.concatenate(_userCxform); 
     return cf;
 }
 

=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h       2010-06-18 12:26:04 +0000
+++ b/libcore/MovieClip.h       2010-06-29 10:22:38 +0000
@@ -266,23 +266,6 @@
     /// This is to suppor the Color asobject class
     cxform  get_world_cxform() const;
 
-    /// Update user-defined color transform
-    //
-    /// This should only be used by the Color AS class
-    void set_user_cxform(const cxform& cx)
-    {
-        set_invalidated();
-        _userCxform = cx;
-    }
-
-    /// Return the user-defined color transform
-    //
-    /// This should only be used by the Color AS class
-    cxform get_user_cxform() const
-    {
-        return _userCxform;
-    }
-
     /// Look up the labeled frame, and jump to it.
     bool goto_labeled_frame(const std::string& label);
         
@@ -881,8 +864,6 @@
     ///
     std::auto_ptr<TextFieldIndex> _text_variables;
 
-    cxform _userCxform;
-
     std::string _droptarget;
 
     // 0-based index to current frame

=== modified file 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color_as.cpp        2010-03-11 01:47:08 +0000
+++ b/libcore/asobj/Color_as.cpp        2010-06-29 10:09:45 +0000
@@ -106,7 +106,7 @@
     MovieClip* sp = getTarget(obj, fn);
     if (!sp) return as_value();
 
-       const cxform& trans = sp->get_user_cxform();
+       const cxform& trans = sp->get_cxform();
 
     const int r = trans.rb;
     const int g = trans.gb;
@@ -125,7 +125,7 @@
     MovieClip* sp = getTarget(obj, fn);
     if (!sp) return as_value();
 
-       const cxform& cx = sp->get_user_cxform();
+       const cxform& cx = sp->get_cxform();
 
        // Convert to as_object
 
@@ -166,7 +166,7 @@
        const int g = (color & 0x00ff00) >> 8;
        const int b = (color & 0x0000ff);
 
-       cxform newTrans = sp->get_user_cxform();
+       cxform newTrans = sp->get_cxform();
        newTrans.rb = static_cast<boost::int16_t>(r);
        newTrans.gb = static_cast<boost::int16_t>(g);
        newTrans.bb = static_cast<boost::int16_t>(b);
@@ -174,7 +174,7 @@
        newTrans.ga = 0;
        newTrans.ba = 0;
 
-    sp->set_user_cxform(newTrans);
+    sp->set_cxform(newTrans);
 
        return as_value();
 }
@@ -206,7 +206,7 @@
 
        string_table& st = getStringTable(*obj);
 
-       cxform newTrans = sp->get_user_cxform();
+       cxform newTrans = sp->get_cxform();
 
        // multipliers
        parseColorTransProp(*trans, st.find("ra"), newTrans.ra, true);
@@ -220,7 +220,7 @@
        parseColorTransProp(*trans, st.find("bb"), newTrans.bb, false);
        parseColorTransProp(*trans, st.find("ab"), newTrans.ab, false);
 
-       sp->set_user_cxform(newTrans);
+       sp->set_cxform(newTrans);
 
        return as_value();
 }

=== modified file 'testsuite/actionscript.all/Color.as'
--- a/testsuite/actionscript.all/Color.as       2010-01-11 06:41:38 +0000
+++ b/testsuite/actionscript.all/Color.as       2010-06-29 10:20:43 +0000
@@ -142,6 +142,34 @@
 check_equals ( trans.aa, 100 );
 check_equals ( trans.ab, 0 );
 
+#if OUTPUT_VERSION > 5
+
+// No createEmptyMovieClip in v5
+
+ort = _root.createEmptyMovieClip("ort", 605);
+c = new Color(ort);
+ctr = c.getTransform();
+check_equals (ctr.ra, 100);
+check_equals (ctr.ga, 100);
+check_equals (ctr.ba, 100);
+check_equals (ctr.aa, 100);
+check_equals (ctr.rb, 0);
+check_equals (ctr.gb, 0);
+check_equals (ctr.bb, 0);
+check_equals (ctr.ab, 0);
+
+ort._alpha = 0;
+ctr = c.getTransform();
+check_equals (ctr.ra, 100);
+check_equals (ctr.ga, 100);
+check_equals (ctr.ba, 100);
+check_equals (ctr.aa, 0);
+check_equals (ctr.rb, 0);
+check_equals (ctr.gb, 0);
+check_equals (ctr.bb, 0);
+check_equals (ctr.ab, 0);
+
+#endif
 
 //-----------------------------------------------------------
 // test the Color::setTransform method
@@ -303,11 +331,11 @@
 // (int16)(12800 / 100.0 * 256) == -12800
 // Gnash failed, but not due to accuracy problem,
 // _alpha is not calculated correctly.
-xcheck_equals(mc1._alpha, -12800);
+check_equals(mc1._alpha, -12800);
 
 trans.ab = 10;
 // _alpha is not calculated correctly. Not sure about the algorithm at the 
moment. 
-xcheck_equals(mc1._alpha, -12800);
+check_equals(mc1._alpha, -12800);
 
 mc1._alpha = 60;
 trans2 = colorObj.getTransform();
@@ -360,4 +388,10 @@
 //-----------------------------------------------------------
 
 
-totals();
+#if OUTPUT_VERSION == 5
+totals(134);
+#elif OUTPUT_VERSION == 6
+totals(165);
+#else
+totals(155);
+#endif

=== modified file 'testsuite/actionscript.all/Transform.as'
--- a/testsuite/actionscript.all/Transform.as   2010-01-01 17:48:26 +0000
+++ b/testsuite/actionscript.all/Transform.as   2010-06-29 10:20:43 +0000
@@ -224,5 +224,62 @@
 xcheck_equals(conc1.transform.concatenatedMatrix.toString(), "(a=0, b=0, c=0, 
d=0, tx=1.5, ty=2)");
 xcheck_equals(conc2.transform.concatenatedMatrix.toString(), "(a=0, b=0, c=0, 
d=0, tx=1.5, ty=2)");
 
-totals(74);
+
+d = _root.createEmptyMovieClip("tar", 600);
+d.beginFill(0x00ff00);
+d.moveTo(20, 20);
+d.lineTo(20, 80);
+d.lineTo(80, 80);
+d.lineTo(80, 40);
+d.lineTo(20, 20);
+
+d.moveTo(50, 50);
+d.beginFill(0xff0000);
+d.lineTo(60, 50);
+d.lineTo(60, 60);
+d.lineTo(50, 60);
+d.lineTo(50, 50);
+
+ct8 = d.transform.colorTransform;
+
+check_equals(ct8.toString(), "(redMultiplier=1, greenMultiplier=1, 
blueMultiplier=1, alphaMultiplier=1, redOffset=0, greenOffset=0, blueOffset=0, 
alphaOffset=0)")
+
+c = new Color(tar);
+c.setRGB(0xff0000);
+
+btx = c.getTransform();
+check_equals(btx.ra, 0);
+check_equals(btx.ba, 0);
+check_equals(btx.ga, 0);
+check_equals(btx.aa, 100);
+check_equals(btx.rb, 255);
+check_equals(btx.gb, 0);
+check_equals(btx.bb, 0);
+check_equals(btx.ab, 0);
+
+ct9 = d.transform.colorTransform;
+check_equals(ct9.toString(), "(redMultiplier=0, greenMultiplier=0, 
blueMultiplier=0, alphaMultiplier=1, redOffset=255, greenOffset=0, 
blueOffset=0, alphaOffset=0)")
+
+c.setRGB(0x0000ff);
+ct10 = d.transform.colorTransform;
+check_equals(ct10.toString(), "(redMultiplier=0, greenMultiplier=0, 
blueMultiplier=0, alphaMultiplier=1, redOffset=0, greenOffset=0, 
blueOffset=255, alphaOffset=0)")
+
+tr = d.transform;
+tr.colorTransform = new ColorTransform(0, 0, 0, 1, 0, 127, 0, 0);
+d.transform = tr;
+ct11 = d.transform.colorTransform;
+check_equals(ct11.toString(), "(redMultiplier=0, greenMultiplier=0, 
blueMultiplier=0, alphaMultiplier=1, redOffset=0, greenOffset=127, 
blueOffset=0, alphaOffset=0)");
+
+// User transform is
+btx = c.getTransform();
+check_equals(btx.ra, 0);
+check_equals(btx.ba, 0);
+check_equals(btx.ga, 0);
+check_equals(btx.aa, 100);
+check_equals(btx.rb, 0);
+check_equals(btx.gb, 127);
+check_equals(btx.bb, 0);
+check_equals(btx.ab, 0);
+
+totals(94);
 #endif

=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING  2010-06-21 07:40:45 +0000
+++ b/testsuite/swfdec/PASSING  2010-06-29 10:22:08 +0000
@@ -227,6 +227,7 @@
 color-properties-7.swf:20f3b3832419655c629d84562ae8edd7
 color-properties-8.swf:a1ae8b87ebc7cc1adf7d9acb8da6592f
 color-setRGB.swf:0841414e9ac7d2f9b57e40aec3d2f44f
+color-setTransform-alpha.swf:d0675ba970d7418e51e38af845bc8a40
 color-setTransform-empty.swf:2a72a5273ab8713ee289ff1726b0959c
 color-setTransform-full.swf:7a8e59cef9592c4546f07fb9f391c61a
 color-setTransform-negative.swf:0bc0510c35fc5c82de31b0db887fe535
@@ -1479,6 +1480,7 @@
 undefinedtrace-v7.swf:
 undefinedtrace-v8.swf:
 unloadmovie-simple-5.swf:3b897f539cb7eb764692def6fcc62853
+various-tests-5.swf:ff6088cd684cb3114303a3ae4e620953
 video-enumerate.swf:5eced177f03fc88bccb99f0acd2d2f7d
 video-properties-6.swf:95109f25a5cac0fe2d18628dcea22633
 video-properties-7.swf:64f07e267ae93cdefec5c51c3fc9981d


reply via email to

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