/src/flash/test.html
HTML | 211 lines | 169 code | 28 blank | 14 comment | 0 complexity | 0f52936bb1d67d134ff6db2836182aed MD5 | raw file
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>Flash Test</title>
- </head>
- <body>
- <script src="../test/test.js"></script>
- <script>KISSY.Test.Config.times = 1;</script>
- <h2>Test Data</h2>
- <div>
- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="200" height="150" id="myFlashContent">
- <param name="movie" value="assets/test.swf"/>
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="assets/test.swf" width="200" height="150">
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="get_flash_player.gif" alt="Get Adobe Flash player"/>
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="150" id="myFlashContent2">
- <param name="movie" value="assets/test.swf"/>
- <!--[if !IE]>-->
- <object type="application/x-shockwave-flash" data="assets/test.swf" width="200" height="150">
- <!--<![endif]-->
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="get_flash_player.gif" alt="Get Adobe Flash player"/>
- </a>
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- </object>
- </div>
- <div id="test-flash3"></div>
- <div id="test-flash4"></div>
- <script src="../../build/packages/kissy.js"></script>
- <script src="../../build/flash/flash-pkg.js"></script>
- <!--
- <script src="flash.js"></script>
- <script src="flash-ua.js"></script>
- <script src="flash-embed.js"></script>
- -->
- <!-- Test Cases -->
- <script>
- var S = KISSY, UA = S.UA, F = S.Flash,RE_FLASH_TAGS = /object|embed/i;
- function test_ua(test) {
- if (UA.fpv() === undefined) test.fail();
- if (!UA.fpvGEQ()) test.fail();
- if (!UA.fpvGEQ('9.1')) test.fail();
- if (!UA.fpvGEQ('9.9.1')) test.fail();
- if (UA.fpvGEQ('18')) test.fail();
- test.extraMsg = '当插件安装不正常时,该测试用例需要 FAILED';
- test.echo('UA.fpv = ' + UA.fpv());
- }
- function test_add_register(test) {
- F.add('#myFlashContent', { version: '99' }, function(data) {
- if (data.status !== 0) test.fail();
- if (F.length > 0) test.fail();
- if(!RE_FLASH_TAGS.test(data.swf.nodeName))test.fail();
- });
- F.add('#myFlashContent2', { version: '9' }, function(data) {
- if (data.status !== 1) test.fail(data.status);
- if (F.length !== 1) test.fail(F.length);
- if(!RE_FLASH_TAGS.test(data.swf.nodeName))test.fail();
- if (data.dynamic) test.fail();
- });
- }
-
-
- function test_len(test) {
- if (F.length !== 1) test.fail(F.length);
- }
- function test_add_embed(test) {
-
- // target 不存在
- F.add('#non-exist', {
- src: 'assets/test.swf',
- version: 9,
- params: {
- wmode:"opaque",
- flashvars: 'a=1&b=2'
- }
- }, function(data) {
-
- });
- // 无 src
- F.add('#test-flash3', null, function(data) {
- if (data.status !== -3) test.fail();
- if (!data.dynamic) test.fail("add('#test-flash3'");
- });
- // 动态添加
- F.add('#test-flash3', {
- src: 'assets/test.swf',
- version: 9,
- attrs: {
- width: 200,
- height: 150
- },
- params: {
- wmode:"window",
- flashvars: {
- s: "string",
- b: false,
- n: 1,
- nul: null,
- und: undefined,
- url: "http://taobao.com/?x=1&z=2",
- o: {
- s: "string",
- b: false,
- n: 1,
- url: "http://taobao.com/?x=1&z=2"
- }
- }
- }
- }, function(data) {
- if (data.status !== 1) test.fail();
- // bugcheck: 重新获取对象,否则还是老对象. 如 入口为 div 如果不重新获取则仍然是 div longzang | 2010/8/9
- if(!RE_FLASH_TAGS.test(data.swf.nodeName))test.fail();
- });
- // 快速安装
- F.add('#test-flash4', {
- src: 'assets/test.swf',
- xi: 'express-install/expressInstall.swf',
- version: 12.2,
- params: {
- wmode:"window",
- flashvars: 'a=1&b=2'
- }
- }, function(data) {
- if (data.status !== 1) test.fail();
- if(!RE_FLASH_TAGS.test(data.swf.nodeName))test.fail();
- if (!data.dynamic) test.fail();
- });
- }
- function test_get(test) {
- if (!S.UA.safari) if ((F.get('myFlashContent2') || 0).nodeName !== 'OBJECT') test.fail();
- }
-
- function test_swfs(test){
- var swf = F.get('myFlashContent2');
- if(!swf)return;
- if(!RE_FLASH_TAGS.test(swf.nodeName))test.fail();
- }
- function test_contains(test) {
- if (S.UA.safari) return;
-
- if (!F.contains('myFlashContent2')) test.fail();
- if (F.contains('#test-xxxxx')) test.fail();
- }
- function test_remove(test) {
- F.remove('#test-flash4');
- if (F.contains('#test-flash4')) test.fail();
- }
- function test_flashvars(test) {
- var o = {
- str: "string",
- bool: false,
- num: 1,
- nul: null,
- und: undefined,
- fn: function() {
- },
- zero: 0,
- empty_str: '',
- url: "http://taobao.com/?x=1&z=2",
- obj: {
- str: "string",
- bool: false,
- num: 1,
- nul: null,
- und: undefined,
- fn: function() {
- },
- zero: 0,
- empty_str: '',
- url: "http://taobao.com/?x=1&z=2"
- }
- };
- test.echo(F.toFlashVars(o));
- o = {a: 1, b: { x: 2, z: 's=1&c=2' }};
- //if(F.toFlashVars(o) !== 'a=1&b={"x":2,"z":"s%3D1%26c%3D2"}') test.fail();
- }
-
-
- </script>
- </body>
- </html>