~ubuntu-branches/ubuntu/karmic/gnash/karmic

« back to all changes in this revision

Viewing changes to testsuite/misc-ming.all/DefineTextTest.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-10-13 14:29:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081013142949-f6qdvnu4mn05ltdc
Tags: 0.8.4~~bzr9980-0ubuntu1
* new upstream release 0.8.4 (LP: #240325)
* ship new lib usr/lib/gnash/libmozsdk.so.* in mozilla-plugin-gnash
  - update debian/mozilla-plugin-gnash.install
* ship new lib usr/lib/gnash/libgnashnet.so.* in gnash-common
  - update debian/gnash-common.install
* add basic debian/build_head script to build latest CVS head packages.
  - add debian/build_head
* new sound architecture requires build depend on libsdl1.2-dev
  - update debian/control
* head build script now has been completely migrated to bzr (upstream +
  ubuntu)
  - update debian/build_head
* disable kde gui until klash/qt4 has been fixed; keep kde packages as empty
  packages for now.
  - update debian/rules
  - debian/klash.install
  - debian/klash.links
  - debian/klash.manpages
  - debian/konqueror-plugin-gnash.install
* drop libkonq5-dev build dependency accordingly
  - update debian/control
* don't install headers manually anymore. gnash doesnt provide a -dev
  package after all
  - update debian/rules
* update libs installed in gnash-common; libgnashserver-*.so is not available
  anymore (removed); in turn we add the new libgnashcore-*.so
  - update debian/gnash-common.install
* use -Os for optimization and properly pass CXXFLAGS=$(CFLAGS) to configure
  - update debian/rules
* touch firefox .autoreg in postinst of mozilla plugin
  - update debian/mozilla-plugin-gnash.postinst
* link gnash in ubufox plugins directory for the plugin alternative switcher
  - add debian/mozilla-plugin-gnash.links
* suggest ubufox accordingly
  - update debian/control
* add new required build-depends on libgif-dev
  - update debian/control
* add Xb-Npp-Description and Xb-Npp-File as new plugin database meta data
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 *   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
3
 * 
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 3 of the License, or
 
7
 * (at your option) any later version.
 
8
 * 
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program; if not, write to the Free Software
 
15
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
16
 *
 
17
 *
 
18
 */ 
 
19
 
 
20
/*
 
21
 * Test DefineText tag.
 
22
 * 
 
23
 * run as ./DefineTextTest <mediadir> to produce DefineTextTest.swf
 
24
 */
 
25
 
 
26
#include <stdlib.h>
 
27
#include <stdio.h>
 
28
#include <ming.h>
 
29
 
 
30
#include "ming_utils.h"
 
31
 
 
32
#define OUTPUT_VERSION 7
 
33
#define OUTPUT_FILENAME "DefineTextTest.swf"
 
34
 
 
35
int
 
36
main(int argc, char** argv)
 
37
{
 
38
  SWFMovie mo;
 
39
  const char *srcdir=".";
 
40
  char fdbfont[256];
 
41
  SWFMovieClip  dejagnuclip;
 
42
  
 
43
  /*********************************************
 
44
   *
 
45
   * Initialization
 
46
   *
 
47
   *********************************************/
 
48
 
 
49
  if ( argc>1 ) srcdir=argv[1];
 
50
  else
 
51
  {
 
52
    fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
 
53
    return 1;
 
54
  }
 
55
 
 
56
  sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir);
 
57
 
 
58
  puts("Setting things up");
 
59
 
 
60
  Ming_init();
 
61
  Ming_useSWFVersion (OUTPUT_VERSION);
 
62
  //Ming_setScale(20.0); /* so we talk twips */
 
63
 
 
64
  mo = newSWFMovie();
 
65
  SWFMovie_setRate(mo, 1.0);
 
66
  SWFMovie_setDimension(mo, 800, 600);
 
67
  
 
68
  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
 
69
  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
 
70
  SWFMovie_nextFrame(mo); // 1st frame 
 
71
 
 
72
  /*********************************************
 
73
   *
 
74
   * Add some textfields
 
75
   *
 
76
   *********************************************/
 
77
  {
 
78
    SWFMovieClip mc; // to check sizes
 
79
    SWFDisplayItem it;
 
80
    SWFText tf;
 
81
 
 
82
    FILE *font_file = fopen(fdbfont, "r");
 
83
    if ( font_file == NULL )
 
84
    {
 
85
      perror(fdbfont);
 
86
      exit(1);
 
87
    }
 
88
    SWFBrowserFont bfont = newSWFBrowserFont("_sans");
 
89
    SWFFont efont = loadSWFFontFromFile(font_file);
 
90
 
 
91
    tf = newSWFText();
 
92
 
 
93
    SWFText_setFont(tf, efont);
 
94
    SWFText_setHeight(tf, 200);
 
95
    SWFText_setColor(tf, 0, 255, 0, 0xff);
 
96
    SWFText_addString(tf, "O", NULL);
 
97
 
 
98
    SWFText_setFont(tf, efont);
 
99
    SWFText_setHeight(tf, 200);
 
100
    SWFText_setColor(tf, 255, 0, 0, 0xff);
 
101
    SWFText_addString(tf, "X", NULL);
 
102
 
 
103
    mc = newSWFMovieClip();
 
104
    it = SWFMovieClip_add(mc, tf);
 
105
    SWFDisplayItem_setName(it, "stext1");
 
106
    SWFMovieClip_nextFrame(mc);
 
107
 
 
108
    it = SWFMovie_add(mo, mc);
 
109
    SWFDisplayItem_setName(it, "mc");
 
110
    SWFDisplayItem_moveTo(it, 0, 400);
 
111
  }
 
112
  SWFMovie_nextFrame(mo);  // 2nd frame
 
113
 
 
114
  // static text is not a referenceable char
 
115
  check_equals(mo, "mc.stext1", "mc");
 
116
  check_equals(mo, "typeof(mc.stext1)", "'movieclip'");
 
117
  check_equals(mo, "mc.stext1._target", "'/mc'");
 
118
 
 
119
  check_equals(mo, "mc._width", "288.05");
 
120
 
 
121
  add_actions(mo, "endoftest=true; totals(); stop();");
 
122
  SWFMovie_nextFrame(mo);  // 3rd frame
 
123
 
 
124
  /*****************************************************
 
125
   *
 
126
   * Output movie
 
127
   *
 
128
   *****************************************************/
 
129
  puts("Saving " OUTPUT_FILENAME );
 
130
 
 
131
  SWFMovie_save(mo, OUTPUT_FILENAME);
 
132
 
 
133
  return 0;
 
134
}