зеркало из https://github.com/mozilla/shumway.git
Add unit test for flash.net.URLRequest
This commit is contained in:
Родитель
9238fb3fb5
Коммит
8ef59fb012
|
@ -0,0 +1 @@
|
|||
BOO!
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Compiled with:
|
||||
java -jar utils/asc.jar -import playerglobal.abc -swf URLRequestTest,100,100 test/swfs/flash_net_URLRequest.as
|
||||
*/
|
||||
|
||||
package {
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class URLRequestTest extends Sprite {
|
||||
public var loader;
|
||||
public function URLRequestTest() {
|
||||
loader = new TestObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.net.*;
|
||||
|
||||
class TestObject extends URLLoader {
|
||||
private var bgColor: uint = 0xFFCC00;
|
||||
private var pos: uint = 10;
|
||||
private var size: uint = 80;
|
||||
private var url = "flash_net_URLRequest.as";
|
||||
|
||||
private var request;
|
||||
|
||||
public function TestObject() {
|
||||
configureListeners(this);
|
||||
request = new URLRequest();
|
||||
request.url = "data.txt";
|
||||
request.data = { "foo": 10, "bar": 20 };
|
||||
request.method = "GET";
|
||||
load(request);
|
||||
}
|
||||
|
||||
private function configureListeners(dispatcher:IEventDispatcher):void {
|
||||
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
|
||||
}
|
||||
|
||||
private function completeHandler(event:Event):void {
|
||||
var data = event.target.data;
|
||||
var result = data.split("\n")[0] === "BOO!" ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.net::URLRequest/set url ()");
|
||||
trace(result + ": flash.net::URLRequest/set data ()");
|
||||
trace(result + ": flash.net::URLRequest/set method ()");
|
||||
var result = request.url === "data.txt" ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.net::URLRequest/get url ()");
|
||||
var result = request.data.bar === 20 ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.net::URLRequest/get data ()");
|
||||
var result = request.method === "GET" ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.net::URLRequest/get method ()");
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
|
@ -0,0 +1,6 @@
|
|||
PASS: flash.net::URLRequest/set url ()
|
||||
PASS: flash.net::URLRequest/set data ()
|
||||
PASS: flash.net::URLRequest/set method ()
|
||||
PASS: flash.net::URLRequest/get url ()
|
||||
PASS: flash.net::URLRequest/get data ()
|
||||
PASS: flash.net::URLRequest/get method ()
|
|
@ -155,6 +155,13 @@
|
|||
],
|
||||
"type": "stas"
|
||||
},
|
||||
{ "id": "flash_net_URLRequest trace",
|
||||
"stas": "swfs/trace.stas",
|
||||
"filenames": [
|
||||
"swfs/flash_net_URLRequest.swf"
|
||||
],
|
||||
"type": "stas"
|
||||
},
|
||||
{ "id": "flash_display_Shape trace",
|
||||
"stas": "swfs/trace.stas",
|
||||
"filenames": [
|
||||
|
|
Загрузка…
Ссылка в новой задаче