gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10071: New test for BitmapData.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10071: New test for BitmapData.
Date: Fri, 24 Oct 2008 12:47:59 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10071
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2008-10-24 12:47:59 +0200
message:
  New test for BitmapData.
added:
  testsuite/misc-ming.all/BitmapDataTest.c
modified:
  testsuite/misc-ming.all/Makefile.am
    ------------------------------------------------------------
    revno: 10039.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: bitmapchar
    timestamp: Fri 2008-10-24 12:45:51 +0200
    message:
      Add tests for BitmapData.
    added:
      testsuite/misc-ming.all/BitmapDataTest.c
    modified:
      testsuite/misc-ming.all/Makefile.am
=== added file 'testsuite/misc-ming.all/BitmapDataTest.c'
--- a/testsuite/misc-ming.all/BitmapDataTest.c  1970-01-01 00:00:00 +0000
+++ b/testsuite/misc-ming.all/BitmapDataTest.c  2008-10-24 10:45:51 +0000
@@ -0,0 +1,106 @@
+/* 
+ *   Copyright (C) 2007 Free Software Foundation, Inc.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */ 
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 8
+#define OUTPUT_FILENAME "BitmapDataTest.swf"
+
+const char* mediadir=".";
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip mc;
+  SWFMovieClip dejagnuclip;
+
+  if ( argc>1 ) mediadir=argv[1];
+  else
+  {
+    fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+    return 1;
+  }
+       
+  Ming_init();
+  Ming_useSWFVersion (OUTPUT_VERSION);
+
+       
+  mo = newSWFMovie();
+  SWFMovie_setDimension(mo, 640, 480);
+
+  if (mo == NULL) return -1;
+
+  add_actions(mo, "_root.onKeyDown = function() {"
+                       "play(); }; "
+                    "Key.addListener(_root);");
+
+  SWFMovie_setRate(mo, 2);
+    dejagnuclip = get_dejagnu_clip(
+            (SWFBlock)get_default_font(mediadir), 10, 10, 200, 800, 600);
+    SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+ 
+  SWFMovie_nextFrame(mo);
+
+  add_actions(mo, "BitmapData = flash.display.BitmapData;"
+                 "Rectangle = flash.geom.Rectangle;"
+                 "bmp = new BitmapData(150, 150, false);"
+                 "rect = new Rectangle(10, 10, 100, 100);"
+                 "bmp.fillRect(rect, 0x223322);"
+                 "mc = _root.createEmptyMovieClip('mc', 
getNextHighestDepth());"
+          "d = mc.getNextHighestDepth();"
+          "mc.attachBitmap(bmp, d);"
+          "bmp2 = new BitmapData(20, 20, true);"
+          "rect2 = new Rectangle (10, 10, 20, 20);"
+          "bmp2.fillRect(rect2, 0xffffff22);"
+          "d2 = mc.getNextHighestDepth();"
+          "mc.attachBitmap(bmp2, d2);"
+          "note('1. You should see a small yellow square in the top left\n"
+                "corner of a larger green square. Press a key.');"
+          "stop();"
+          );
+
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo, "rect = new Rectangle (90, 90, 120, 120);"
+                   "bmp.fillRect(rect, 0xffee66);"
+            "note('2. You should see a new pale yellow square covering the \n"
+                "bottom right corner of the large green square. Press a 
key.');"
+            "stop();"
+            );
+
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo, "mc.createEmptyMovieClip('d', d);"
+            "note('3. You should see just the small yellow square in the top\n"
+                "left corner. Press a key.');");
+
+    add_actions(mo, "stop();");
+
+    SWFMovie_nextFrame(mo);
+    
+  //Output movie
+  puts("Saving " OUTPUT_FILENAME );
+  SWFMovie_save(mo, OUTPUT_FILENAME);
+
+  return 0;
+}

=== modified file 'testsuite/misc-ming.all/Makefile.am'
--- a/testsuite/misc-ming.all/Makefile.am       2008-10-08 10:47:01 +0000
+++ b/testsuite/misc-ming.all/Makefile.am       2008-10-24 10:45:51 +0000
@@ -177,6 +177,7 @@
        runtime_vm_stack_test \
        new_child_in_unload_test \
        instanceNameTest \
+       BitmapDataTest \
        $(NULL)
 
 if MING_VERSION_0_4_3
@@ -1427,8 +1428,21 @@
 XMLSocketTest.swf: XMLSocketTest
        ./XMLSocketTest $(top_srcdir)/testsuite/media
 
+BitmapDataTest_SOURCES = \
+       BitmapDataTest.c \
+       $(NULL)
+
+BitmapDataTest_CFLAGS = \
+       -DMEDIADIR='"$(abs_mediadir)"' \
+       $(NULL)
+
+BitmapDataTest_LDADD = libgnashmingutils.la
+
+BitmapDataTest.swf: BitmapDataTest
+       ./BitmapDataTest $(top_srcdir)/testsuite/media
+
 EmbeddedSoundTest_SOURCES = \
-       EmbeddedSoundTest.c
+       EmbeddedSoundTest.c \
        $(NULL)
 
 EmbeddedSoundTest_CFLAGS = \


reply via email to

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