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

« back to all changes in this revision

Viewing changes to testsuite/misc-ming.all/SharedObjectTest.as

  • 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) 2007, 2008 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
//
 
14
// You should have received a copy of the GNU General Public License
 
15
// along with this program; if not, write to the Free Software
 
16
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 
 
18
 
 
19
//
 
20
//
 
21
// NOTE: to test this with the proprietary player:
 
22
//
 
23
//     $ make SharedObjectTestRunner
 
24
//     $ ./SharedObjectTestRunner flashplayer ~/.macromedia/Flash_Player/#SharedObjects/<key>
 
25
//     
 
26
// take a look at the #SharedObject dir to figure out what <key> should be
 
27
// 
 
28
//
 
29
//
 
30
 
 
31
#define pass_check(x) _root.pass(x)
 
32
#define xpass_check(x) _root.xpass(x)
 
33
#define fail_check(x) _root.fail(x)
 
34
#define xfail_check(x) _root.xfail(x)
 
35
 
 
36
#define USE_DEJAGNU_MODULE
 
37
#include "../actionscript.all/check.as"
 
38
 
 
39
note();
 
40
note("NOTE: for this test to work you should have copied");
 
41
note("      testsuite/misc-ming.all/SharedObjectTest.sol/*.sol");
 
42
note("      to this flash player's appropriate SharedObject dir");
 
43
note();
 
44
 
 
45
so1 = SharedObject.getLocal("sol1");
 
46
 
 
47
check_equals(so1.data.num, 2);
 
48
check_equals(so1.data.str, 'a string');
 
49
check_equals(typeof(so1.data.tbool), 'boolean');
 
50
check_equals(so1.data.tbool, true);
 
51
check_equals(typeof(so1.data.fbool), 'boolean');
 
52
check_equals(so1.data.fbool, false);
 
53
 
 
54
// MovieClip value mc was NOT discarded, but written (or read?) as undefined
 
55
check(so1.data.hasOwnProperty('mc'));
 
56
check_equals(typeof(so1.data.mc), 'undefined');
 
57
 
 
58
// Function value was discarded
 
59
check(! so1.data.hasOwnProperty('fun') );
 
60
 
 
61
 
 
62
// Test reading mixed types in ECMA_ARRAY 
 
63
check_equals(typeof(so1.data.ary), 'object');
 
64
check_equals(so1.data.ary.toString(), '1,true,string,null,');
 
65
check_equals(typeof(so1.data.ary[0]), 'number');
 
66
check_equals(typeof(so1.data.ary[1]), 'boolean');
 
67
check_equals(typeof(so1.data.ary[2]), 'string');
 
68
check_equals(typeof(so1.data.ary[3]), 'null');
 
69
check_equals(typeof(so1.data.ary[4]), 'undefined');
 
70
check_equals(so1.data.ary.length, 5);
 
71
// test composition
 
72
tmp = so1.data.ary; // work-around to an old Ming bug [ chokes on 'for (in in a.b.c)' ]
 
73
a=[]; for (i in tmp) a.push(i);
 
74
a.sort();
 
75
check_equals(a.toString(), '0,1,2,3,4'); // note: no 'length'
 
76
 
 
77
// Test reading ECMA_ARRAY
 
78
check_equals(typeof(so1.data.aryns), 'object');
 
79
check_equals(so1.data.aryns.toString(), '4,5,6,,,,,');
 
80
check_equals(so1.data.aryns.length, 8);
 
81
check_equals(so1.data.aryns.custom, 7);
 
82
// test composition
 
83
tmp = so1.data.aryns; // work-around to an old Ming bug [ chokes on 'for (in in a.b.c)' ]
 
84
a=[]; for (i in tmp) a.push(i);
 
85
a.sort();
 
86
check_equals(a.toString(), '0,1,2,custom'); // note: no 'length'
 
87
 
 
88
// Test reading OBJECT
 
89
check(so1.data.obj instanceOf Object);
 
90
check_equals(typeof(so1.data.obj), 'object');
 
91
check_equals(typeof(so1.data.obj.a), 'number');
 
92
check(so1.data.obj.hasOwnProperty('a'));
 
93
check(!so1.data.obj.hasOwnProperty('hidden'));
 
94
check(so1.data.obj.hasOwnProperty('mc'));
 
95
check_equals(typeof(so1.data.obj.mc), 'undefined');
 
96
// Function value was discarded
 
97
check(! so1.data.obj.hasOwnProperty('fun') );
 
98
 
 
99
// Test reading NUMBER
 
100
check_equals(so1.data.obj.a, 10);
 
101
 
 
102
// Test reading STRING
 
103
check_equals(typeof(so1.data.obj.b), 'string');
 
104
check_equals(so1.data.obj.b, '20');
 
105
 
 
106
// Test reading BOOLEAN
 
107
check_equals(typeof(so1.data.obj.c), 'boolean');
 
108
check_equals(so1.data.obj.c, true);
 
109
 
 
110
// Test reading REFERENCE
 
111
check_equals(typeof(so1.data.ref), 'object');
 
112
check_equals(so1.data.ref, so1.data.obj); 
 
113
 
 
114
// force writing the sol or the adobe player won't save it
 
115
// again. This will also serve as a kind of reference for
 
116
// how the sol file was produced in the first place
 
117
so1.data.num = 2; 
 
118
so1.data.str = 'a string'; 
 
119
so1.data.tbool = true;
 
120
so1.data.fbool = false;
 
121
 
 
122
so1.data.ary = [1,true,'string',null, undefined];  // ECMA_ARRAY
 
123
so1.data.ary.hidden = 6;
 
124
AsSetPropFlags(so1.data.ary, 'hidden', 1); // hide from enumeration, should not end into the sol file
 
125
 
 
126
 
 
127
so1.data.aryns = [4,5,6];
 
128
so1.data.aryns.fun = function() {}; // functions in arrays are simply skipped
 
129
so1.data.aryns.custom = 7;
 
130
so1.data.aryns.length = 8; // non-strict array (ECMA_ARRAY)
 
131
 
 
132
so1.data.obj = {a:10,b:'20',c:true};
 
133
so1.data.obj.fun = function() {}; // functions in objects are simply skipped
 
134
so1.data.obj.mc = createEmptyMovieClip("mc1", 1); // movieclip values are skipped
 
135
 
 
136
//AsSetPropFlags(so1.data.obj, '__proto__', 0, 1); // if we unhide __proto__ we'll find it in the SharedObject
 
137
 
 
138
AsSetPropFlags(so1.data.obj, '__constructor__', 0, 1); // unhide __constructor__ (it's a function so will be skipped anyway)
 
139
AsSetPropFlags(so1.data.obj, 'constructor', 0, 1); // unhide constructor (it's a function so will be skipped anyway)
 
140
// so1.data.obj.constructor = 4; // if we override constructor we'll find it
 
141
 
 
142
so1.data.obj.hidden = 7;
 
143
AsSetPropFlags(so1.data.obj, 'hidden', 1); // hide from enumeration, should not end into the sol file
 
144
 
 
145
so1.data.ref = so1.data.obj;
 
146
 
 
147
so1.data.fun = function() {}; // functions in data 
 
148
so1.data.mc = createEmptyMovieClip("mc2", 2); // movieclip values are skipped
 
149
 
 
150
//AsSetPropFlags(so1.data, '__proto__', 0, 1); // if we unhide __proto__ we'll find it in the SharedObject
 
151
AsSetPropFlags(so1.data, '__constructor__', 0, 1); // unhide __constructor__ (it's a function so will be skipped anyway)
 
152
AsSetPropFlags(so1.data, 'constructor', 0, 1); // unhide constructor (it's a function so will be skipped anyway)
 
153
 
 
154
so1.flush();
 
155
 
 
156
quit = function()
 
157
{
 
158
        loadMovie('fscommand:quit', '');
 
159
};
 
160
 
 
161
note(" -  Will quit in 5 seconds, feel free to explicitly quit otherwise -");
 
162
note();
 
163
 
 
164
setInterval(quit, 5000);
 
165
stop();
 
166
 
 
167
check_totals(38);