@@ -4,8 +4,10 @@ import (
44 "encoding/base64"
55 "testing"
66
7+ "github.com/zencoder/go-dash/helpers/ptrs"
78 . "github.com/zencoder/go-dash/helpers/ptrs"
89 "github.com/zencoder/go-dash/helpers/require"
10+ "github.com/zencoder/go-dash/helpers/testfixtures"
911)
1012
1113const (
@@ -41,6 +43,7 @@ const (
4143 VALID_SUBTITLE_ID string = "subtitle_en"
4244 VALID_SUBTITLE_URL string = "http://example.com/content/sintel/subtitles/subtitles_en.vtt"
4345 VALID_ROLE string = "main"
46+ VALID_LOCATION string = "https://example.com/location.mpd"
4447)
4548
4649func TestNewMPDLive (t * testing.T ) {
@@ -484,3 +487,30 @@ func TestAddNewAccessibilityElement(t *testing.T) {
484487 require .EqualStringPtr (t , Strptr ((string )(ACCESSIBILITY_ELEMENT_SCHEME_DESCRIPTIVE_AUDIO )), elem .SchemeIdUri )
485488 require .EqualStringPtr (t , Strptr ("1" ), elem .Value )
486489}
490+
491+ func TestLocationWriteToString (t * testing.T ) {
492+ m := & MPD {
493+ XMLNs : ptrs .Strptr ("urn:mpeg:dash:schema:mpd:2011" ),
494+ Profiles : ptrs .Strptr ((string )(DASH_PROFILE_LIVE )),
495+ Type : ptrs .Strptr ("dynamic" ),
496+ AvailabilityStartTime : ptrs .Strptr (VALID_AVAILABILITY_START_TIME ),
497+ MinimumUpdatePeriod : ptrs .Strptr (VALID_MINIMUM_UPDATE_PERIOD ),
498+ PublishTime : ptrs .Strptr (VALID_AVAILABILITY_START_TIME ),
499+ Location : VALID_LOCATION ,
500+ }
501+
502+ got , err := m .WriteToString ()
503+ require .NoError (t , err )
504+
505+ testfixtures .CompareFixture (t , "fixtures/location.mpd" , got )
506+ }
507+
508+ func TestReadLocation (t * testing.T ) {
509+ m , err := ReadFromFile ("fixtures/location.mpd" )
510+ require .NoError (t , err )
511+
512+ got , err := m .WriteToString ()
513+ require .NoError (t , err )
514+
515+ testfixtures .CompareFixture (t , "fixtures/location.mpd" , got )
516+ }
0 commit comments