зеркало из https://github.com/mozilla/shumway.git
Add unit tests for Point, System, Security, SecurityDomain; fix a typo in ByteArray().length
This commit is contained in:
Родитель
e5ffc2603e
Коммит
22e12b971a
|
@ -1372,7 +1372,7 @@ var natives = (function () {
|
|||
var cap = this.a.byteLength;
|
||||
/* XXX: Do we need to zero the difference if length <= cap? */
|
||||
if (length > cap) {
|
||||
this.ensureSize(length);
|
||||
this.ensureCapacity(length);
|
||||
}
|
||||
this.length = length;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,15 @@ class Test extends Sprite {
|
|||
trace(result + ": flash.display::Stage/set scaleMode ()");
|
||||
})();
|
||||
break;
|
||||
case 9:
|
||||
(function () {
|
||||
var event = new Event(Event.CANCEL);
|
||||
stage.addEventListener(Event.CANCEL, function (e) {
|
||||
trace("PASS" + ": flash.display::Stage/dispatchEvent ()");
|
||||
});
|
||||
stage.dispatchEvent(event);
|
||||
})();
|
||||
break;
|
||||
default:
|
||||
stage.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
|
||||
break;
|
||||
|
|
Двоичные данные
test/swfs/flash_display_Stage.swf
Двоичные данные
test/swfs/flash_display_Stage.swf
Двоичный файл не отображается.
|
@ -9,3 +9,4 @@ PASS: flash.display::Stage/get align ()
|
|||
PASS: flash.display::Stage/set align ()
|
||||
PASS: flash.display::Stage/get scaleMode ()
|
||||
PASS: flash.display::Stage/set scaleMode ()
|
||||
PASS: flash.display::Stage/dispatchEvent ()
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Compiled with:
|
||||
java -jar utils/asc.jar -import playerglobal.abc -swf Class,100,100,2 test/swfs/flash_geom_Point.as
|
||||
*/
|
||||
|
||||
package {
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class PointTest extends Sprite {
|
||||
public function PointTest() {
|
||||
var child = new TestObject();
|
||||
addChild(child);
|
||||
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.net.*;
|
||||
|
||||
class TestObject extends Sprite {
|
||||
private var bgColor: uint = 0xFFCC00;
|
||||
private var pos: uint = 10;
|
||||
private var size: uint = 80;
|
||||
|
||||
private var point;
|
||||
|
||||
public function TestObject() {
|
||||
point = new Point(3, 4);
|
||||
}
|
||||
|
||||
private var frameCount = 0;
|
||||
|
||||
function enterFrameHandler(event:Event):void {
|
||||
frameCount++;
|
||||
var target = event.target;
|
||||
switch (frameCount) {
|
||||
case 1:
|
||||
(function () {
|
||||
var point2 = new Point(3, 4);
|
||||
var result = point2.equals(point) ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.geom::Point/equals ()");
|
||||
})();
|
||||
break;
|
||||
default:
|
||||
parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
|
@ -0,0 +1,78 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Compiled with:
|
||||
java -jar utils/asc.jar -strict -import playerglobal.abc -swf SecurityTest,100,100,10 test/swfs/package_Security.as
|
||||
*/
|
||||
|
||||
package {
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class SecurityTest extends Sprite {
|
||||
public var loader;
|
||||
public function SecurityTest() {
|
||||
stage.frameRate = 10;
|
||||
var child = new TestObject();
|
||||
addChild(child);
|
||||
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.system.*;
|
||||
import flash.utils.*;
|
||||
|
||||
class TestObject extends Sprite {
|
||||
private var bgColor: uint = 0xFFCC00;
|
||||
private var pos: uint = 10;
|
||||
private var size: uint = 80;
|
||||
|
||||
/*
|
||||
Install event listeners for testing events, construct and add child
|
||||
objects, do all other initialization for this test.
|
||||
*/
|
||||
public function TestObject() {
|
||||
}
|
||||
|
||||
/*
|
||||
Set and get properties that have a UI affect to test both screen
|
||||
capture and property values.
|
||||
*/
|
||||
|
||||
private var initialTotalMemory;
|
||||
private var initialTotalMemoryNumber;
|
||||
private var byteArray;
|
||||
|
||||
private var frameCount = 0;
|
||||
function enterFrameHandler(event:Event):void {
|
||||
frameCount++;
|
||||
var target = event.target;
|
||||
var loader = target.loader;
|
||||
switch (frameCount) {
|
||||
case 1:
|
||||
// FIXME need deeper tests
|
||||
(function () {
|
||||
trace("sandboxType=" + Security.sandboxType);
|
||||
var result = !!Security.sandboxType ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.system::Security/get sandboxType ()");
|
||||
})();
|
||||
(function () {
|
||||
trace("allowDomain=" + Security.allowDomain);
|
||||
var result = !!Security.allowDomain ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.system::Security/allowDomain ()");
|
||||
})();
|
||||
(function () {
|
||||
trace("allowInsecureDomain=" + Security.allowInsecureDomain);
|
||||
var result = !!Security.allowInsecureDomain ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.system::Security/allowInsecureDomain ()");
|
||||
})();
|
||||
break;
|
||||
default:
|
||||
parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
|
@ -0,0 +1,6 @@
|
|||
sandboxType=remote
|
||||
PASS: flash.system::Security/get sandboxType ()
|
||||
allowDomain=function Function() {}
|
||||
PASS: flash.system::Security/allowDomain ()
|
||||
allowInsecureDomain=function Function() {}
|
||||
PASS: flash.system::Security/allowInsecureDomain ()
|
|
@ -0,0 +1,67 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Compiled with:
|
||||
java -jar utils/asc.jar -import playerglobal.abc -swf SecurityDomainTest,100,100,10 test/swfs/package_SecurityDomain.as
|
||||
*/
|
||||
|
||||
package {
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class SecurityDomainTest extends Sprite {
|
||||
public var loader;
|
||||
public function SecurityDomainTest() {
|
||||
stage.frameRate = 10;
|
||||
var child = new TestObject();
|
||||
addChild(child);
|
||||
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.system.*;
|
||||
import flash.utils.*;
|
||||
|
||||
class TestObject extends Sprite {
|
||||
private var bgColor: uint = 0xFFCC00;
|
||||
private var pos: uint = 10;
|
||||
private var size: uint = 80;
|
||||
|
||||
/*
|
||||
Install event listeners for testing events, construct and add child
|
||||
objects, do all other initialization for this test.
|
||||
*/
|
||||
public function TestObject() {
|
||||
}
|
||||
|
||||
/*
|
||||
Set and get properties that have a UI affect to test both screen
|
||||
capture and property values.
|
||||
*/
|
||||
|
||||
private var initialTotalMemory;
|
||||
private var initialTotalMemoryNumber;
|
||||
private var byteArray;
|
||||
|
||||
private var frameCount = 0;
|
||||
function enterFrameHandler(event:Event):void {
|
||||
frameCount++;
|
||||
var target = event.target;
|
||||
var loader = target.loader;
|
||||
switch (frameCount) {
|
||||
case 1:
|
||||
(function () {
|
||||
trace("currentDomain=" + SecurityDomain.currentDomain);
|
||||
var result = !!SecurityDomain.currentDomain ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.system::SecurityDomain/get currentDomain ()");
|
||||
})();
|
||||
break;
|
||||
default:
|
||||
parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
|
@ -0,0 +1,2 @@
|
|||
currentDomain=undefined
|
||||
FAIL: flash.system::SecurityDomain/get currentDomain ()
|
|
@ -0,0 +1,79 @@
|
|||
/* -*- Mode: java; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Compiled with:
|
||||
java -jar utils/asc.jar -import playerglobal.abc -swf SystemTest,100,100,2 test/swfs/package_System.as
|
||||
*/
|
||||
|
||||
package {
|
||||
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class SystemTest extends Sprite {
|
||||
public var loader;
|
||||
public function SystemTest() {
|
||||
var child = new TestObject();
|
||||
addChild(child);
|
||||
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import flash.display.*;
|
||||
import flash.events.*;
|
||||
import flash.system.*;
|
||||
import flash.utils.*;
|
||||
|
||||
class TestObject extends Sprite {
|
||||
private var bgColor: uint = 0xFFCC00;
|
||||
private var pos: uint = 10;
|
||||
private var size: uint = 80;
|
||||
|
||||
/*
|
||||
Install event listeners for testing events, construct and add child
|
||||
objects, do all other initialization for this test.
|
||||
*/
|
||||
public function TestObject() {
|
||||
}
|
||||
|
||||
/*
|
||||
Set and get properties that have a UI affect to test both screen
|
||||
capture and property values.
|
||||
*/
|
||||
|
||||
private var initialTotalMemory;
|
||||
private var initialTotalMemoryNumber;
|
||||
private var byteArray;
|
||||
|
||||
private var frameCount = 0;
|
||||
function enterFrameHandler(event:Event):void {
|
||||
frameCount++;
|
||||
var target = event.target;
|
||||
var loader = target.loader;
|
||||
switch (frameCount) {
|
||||
case 1:
|
||||
(function () {
|
||||
initialTotalMemory = System.totalMemory;
|
||||
initialTotalMemoryNumber = System.totalMemoryNumber;
|
||||
byteArray = new ByteArray();
|
||||
byteArray.length = 1000000
|
||||
})();
|
||||
break;
|
||||
case 2:
|
||||
(function () {
|
||||
var result = System.totalMemory > initialTotalMemory ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.system::System/get totalMemory ()");
|
||||
var result = System.totalMemoryNumber > initialTotalMemoryNumber ? "PASS" : "FAIL";
|
||||
trace(result + ": flash.system::System/get totalMemoryNumber ()");
|
||||
})();
|
||||
break;
|
||||
case 3:
|
||||
(function () {
|
||||
})();
|
||||
break;
|
||||
default:
|
||||
parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
|
@ -0,0 +1,2 @@
|
|||
FAIL: flash.system::System/get totalMemory ()
|
||||
FAIL: flash.system::System/get totalMemoryNumber ()
|
|
@ -119,5 +119,26 @@
|
|||
"swfs/flash_display_Stage.swf"
|
||||
],
|
||||
"type": "stas"
|
||||
},
|
||||
{ "id": "flash_system_System trace",
|
||||
"stas": "swfs/trace.stas",
|
||||
"filenames": [
|
||||
"swfs/flash_system_System.swf"
|
||||
],
|
||||
"type": "stas"
|
||||
},
|
||||
{ "id": "flash_system_Security trace",
|
||||
"stas": "swfs/trace.stas",
|
||||
"filenames": [
|
||||
"swfs/flash_system_Security.swf"
|
||||
],
|
||||
"type": "stas"
|
||||
},
|
||||
{ "id": "flash_system_SecurityDomain trace",
|
||||
"stas": "swfs/trace.stas",
|
||||
"filenames": [
|
||||
"swfs/flash_system_SecurityDomain.swf"
|
||||
],
|
||||
"type": "stas"
|
||||
}
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче