PageRenderTime 22ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/test/src/nativeElement/NativeElementTests.hx

http://github.com/silexlabs/Cocktail
Haxe | 60 lines | 36 code | 10 blank | 14 comment | 0 complexity | 6c46e2b6ab9d741f2b607b35cd953560 MD5 | raw file
 1/*This file is part of Silex - see http://projects.silexlabs.org/?/silex
 2
 3Silex is Š 2010-2011 Silex Labs and is released under the GPL License:
 4
 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 
 6
 7This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 8
 9To read the license please visit http://www.gnu.org/copyleft/gpl.html
10*/
11package nativeElement;
12
13
14import haxe.Log;
15import cocktail.nativeElement.NativeElement;
16import utest.Assert;
17import utest.Runner;
18import utest.ui.Report;
19import cocktail.nativeElement.NativeElementManager;
20import cocktail.nativeElement.NativeElementData;
21
22
23/**
24 * Test the cross-platform native element manager 
25 *@author Yannick DOMINGUEZ
26 */
27class NativeElementTests 
28{
29	public static function main()
30	{
31		var runner = new Runner();
32		runner.addCase(new NativeElementTests());
33		Report.create(runner);
34		runner.run();
35	}
36	
37	public function new() 
38	{
39		
40	}
41	
42	public function testNativeElement()
43	{
44		var domRoot:NativeElement = NativeElementManager.getRoot();
45		
46		#if flash9
47		Assert.is(domRoot, flash.display.Stage);
48		#elseif js
49		Assert.same(domRoot.nodeName, "BODY");
50		#end
51		
52		var nativeGraphicReference:NativeElement = NativeElementManager.createNativeElement(graphic);
53		
54		#if flash9
55		Assert.is(nativeGraphicReference, flash.display.Sprite);
56		#elseif js
57		Assert.same(nativeGraphicReference.nodeName, "CANVAS");
58		#end
59	}
60}