2 * Unit Test: MultiMediaView
4 * Wonseop Kim <wonseop.kim@samsung.com>
6 /*jslint browser: true*/
7 /*global $, jQuery, test, equal, ok*/
8 $( document ).ready( function ( ) {
9 module("MultiMediaView");
11 var unit_multimediaview = function ( widget, type ) {
26 widget.multimediaview( );
27 ok( widget.hasClass("ui-multimediaview") , "Create");
29 playpause = widget.parent( ).find('.ui-playpausebutton') ;
30 ok( playpause.hasClass("ui-play-icon") , "Markup: Play button present");
31 if ( type == 'vedio') {
32 fullScreen = widget.parent( ).find('.ui-fullscreenbutton') ;
33 ok( fullScreen.hasClass("ui-fullscreen-on") , "Markup: fullscreen button present");
35 volumebutton = widget.parent( ).find('.ui-volumebutton') ;
36 ok( volumebutton.hasClass("ui-volume-icon") , "Markup: Volume button present");
37 seekerbar = widget.parent( ).find('.ui-seekbar') ;
38 equal( seekerbar.find(".ui-currenttime").css('width'), '0px', "Markup: initial current time");
39 ok( widget.parent( ).find(".ui-durationlabel"), "Markup : duration label");
40 ok( widget.parent( ).find(".ui-timestamplabel"), "Markup : current time label");
41 ok( widget.parent( ).find(".ui-volumecontrol"), "Markup : volume control");
45 widget.multimediaview("width", width );
46 equal( width, widget.width( ), "API: width");
48 equal( width, widget.multimediaview("width") , "API: width multimediaview");
52 widget.multimediaview("height", height );
53 equal( height, widget.height( ), "API: height");
54 equal( height, widget.multimediaview("height") , "API: height multimediaview");
55 if ( type === "video") {
58 fullscreenButton = widget.parent( ).find(".ui-fullscreenbutton");
59 equal( false, widget.multimediaview("fullScreen") , "API: fullScreen initially value - multimediaview");
61 widget.multimediaview("fullScreen", true );
62 ok( fullscreenButton.hasClass("ui-fullscreen-off"), "API: fullScreen ( on ) - markup");
63 equal( true, widget.multimediaview("fullScreen") , "API: fullScreen set to true - multimediaview");
64 equal( $("body")[0].clientHeight - 1 , widget.height( ), "API: height after full screen on");
65 equal( $("body")[0].clientWidth , widget.width( ), "API: width after full screen on");
67 widget.multimediaview("fullScreen", false );
68 ok( fullscreenButton.hasClass("ui-fullscreen-on"), "API: fullScreen ( off ) - markup");
69 equal( false, widget.multimediaview("fullScreen") , "API: fullScreen set to true - multimediaview");
70 equal( widget.height( ) , height, "API: height after full screen off");
71 equal( widget.width( ) , width, "API: width after full screen off");
76 test("video", function ( ) {
77 $('#multimediaview0').page( );
78 unit_multimediaview( $("#video"), "video");
81 test("audio", function ( ) {
82 $('#multimediaview1').page( );
83 unit_multimediaview( $("#audio"), "audio");
86 test("audio dymanic", function ( ) {
88 var createEvent = false,
89 audioHTML = '<audio data-controls= "false"style= "width:100%;"id= "audioControl2"data-fullscreen= "false"class= "multimediaobjetc">' +
90 '<source src= "http://www.w3schools.com/html5/mov_bbb.mp4"type= "audio/mp4"/>' +
91 '<source src= "http://www.w3schools.com/html5/mov_bbb.ogg"type= "audio/ogg"/>' +
92 '<p>Your browser does not support the audio tag.</p>' +
94 $('#multimediaview11').page( );
95 $('#multimediaview11').find(":jqmData(role=content)").append( audioHTML );
97 $("#audioControl").bind("create", function ( ) {
101 $('#audioControl2').trigger("create") ;
102 equal( createEvent, true, "Audio Create Event") ;
103 unit_multimediaview( $("#audioControl2"), "audio");
106 test("video dymanic", function ( ) {
108 var createEvent = false,
109 videoHTML = '<video data-controls= "true"style= "width:100%;"id= "vedioControl1"data-fullscreen= "false"class= "multimediaobjetc">' +
110 '<source src= "http://www.w3schools.com/html5/mov_bbb.mp4"type= "video/mp4"/>' +
111 '<source src= "http://www.w3schools.com/html5/mov_bbb.ogg"type= "video/ogg"/>' +
112 '<source src= "http://www.w3schools.com/html5/mov_bbb.webm"type= "video/webm"/>' +
113 '<p>Your browser does not support the video tag.</p>' +
115 $('#multimediaview01').page( );
116 $('#multimediaview01').find(":jqmData(role=content)").append( videoHTML ) ;
118 $("#vedioControl1").bind("create", function ( ) {
121 $('#vedioControl1').trigger("create") ;
122 equal( createEvent, true, "Vedio Create Event") ;
123 unit_multimediaview( $("#vedioControl1"), "video");