Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tests.com.hbo.suites.factories.specialfeatures
- {
- import com.hbo.gocore.factories.InteractiveFeatureFactory;
- import com.hbo.gocore.model.vo.specialfeatures.MapVO;
- import flash.events.ErrorEvent;
- import flash.events.Event;
- import flash.events.IOErrorEvent;
- import flash.events.SecurityErrorEvent;
- import flash.net.URLLoader;
- import flash.net.URLRequest;
- import org.flexunit.assertThat;
- import org.flexunit.asserts.fail;
- import org.flexunit.async.Async;
- import org.hamcrest.number.greaterThanOrEqualTo;
- import org.hamcrest.object.notNullValue;
- public class MapParsingTest
- {
- private static const TIMEOUT:int = 2 * 1000;
- [Embed(source="/assets/xml/map-viewisimage-takeover.xml")]
- private var mapXMLClass:Class;
- [Before]
- public function setup():void
- {
- }
- [After]
- public function tearDown():void
- {
- }
- private function validateMapVO(mapVO:MapVO):void
- {
- assertThat(mapVO, notNullValue());
- assertThat(mapVO.title, notNullValue());
- assertThat(mapVO.title.length, greaterThanOrEqualTo(1));
- assertThat(mapVO.body, notNullValue());
- assertThat(mapVO.body.length, greaterThanOrEqualTo(1));
- assertThat(mapVO.imageURL, notNullValue());
- assertThat(mapVO.imageURL.length, greaterThanOrEqualTo(1));
- }
- [Test]
- public function createMapVOFromWordDocumentNewXML():void
- {
- var wordDocAlsoKnownAsIPadXML:XML = <takeover view="image" baseref="/SPECIAL_FEATURES/GAME_OF_THRONES/SEASON_02/CONTENT/">
- <title>Maidenpool</title>
- <subtitle />
- <body>Legend has named this Riverlands town, where the fool Florian spotted the maiden Jonquil bathing in a pool.</body>
- <asset>
- <imageUrl>IMAGE_TAKEOVER/EP205-15/740581_00-21-08_tkvr_ipad_map-maidenpool.jpg</imageUrl>
- </asset>
- <links>
- <share>
- <iconURL>ICONS/shareIcon.png</iconURL>
- <title>SHARE</title>
- </share>
- </links>
- </takeover>;
- var mapVO:MapVO = InteractiveFeatureFactory.getMapVO(wordDocAlsoKnownAsIPadXML, null);
- validateMapVO(mapVO);
- }
- [Test]
- public function createMapVOFromOldXML():void
- {
- var oldXML:XML = <takeover view="map" baseref="/SPECIAL_FEATURES/GAME_OF_THRONES/SEASON_02/CONTENT/MAP_TAKEOVER/">
- <medias>
- <media type="image" id="map" src="maidenpool.jpg" />
- </medias>
- <texts>
- <text type="title">MAIDENPOOL</text>
- <text type="long">
- <![CDATA[
- <p>Legend has named this Riverlands spot where the fool Florian spotted the maiden Jonquil bathing in a pool.</p>
- ]]>
- </text>
- </texts>
- </takeover>;
- var mapVO:MapVO = InteractiveFeatureFactory.getMapVO(oldXML, null);
- validateMapVO(mapVO);
- }
- [Test]
- public function testTakeoverViewAsImageXML():void
- {
- var mapXML:XML = mapXMLClass.data as XML;
- var mapVO:MapVO = InteractiveFeatureFactory.getMapVO(mapXML, null);
- validateMapVO(mapVO);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment