< Summary

Class:DCL.Components.DCLVideoClip
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Video/DCLVideoClip.cs
Covered lines:10
Uncovered lines:4
Coverable lines:14
Total lines:49
Line coverage:71.4% (10 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetDataFromJSON(...)0%110100%
DCLVideoClip()0%110100%
GetClassId()0%2100%
ApplyChanges()0%330100%
GetUrl()0%2.032080%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Video/DCLVideoClip.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using System.Linq;
 4using DCL.Controllers;
 5using DCL.Helpers;
 6using DCL.Models;
 7
 8namespace DCL.Components
 9{
 10    public class DCLVideoClip : BaseDisposable
 11    {
 12        [System.Serializable]
 13        public class Model : BaseModel
 14        {
 15            public string url;
 16
 1517            public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<Model>(json); }
 18        }
 19
 020        public bool isExternalURL { get; private set; }
 021        public bool isStream { get; private set; }
 22
 4523        public DCLVideoClip() { model = new Model(); }
 24
 025        public override int GetClassId() { return (int) CLASS_ID.VIDEO_CLIP; }
 26
 27        public override IEnumerator ApplyChanges(BaseModel newModel)
 28        {
 1529            Model model = (Model) newModel;
 1530            isExternalURL = model.url.StartsWith("http://") || model.url.StartsWith("https://");
 7531            isStream = !new[] { ".mp4", ".ogg", ".mov", ".webm" }.Any(x => model.url.EndsWith(x));
 1532            yield break;
 33        }
 34
 35        public string GetUrl()
 36        {
 1537            Model model = (Model) this.model;
 38
 1539            string contentsUrl = model.url;
 40
 1541            if (!isExternalURL)
 42            {
 043                scene.contentProvider.TryGetContentsUrl(model.url, out contentsUrl);
 44            }
 45
 1546            return contentsUrl;
 47        }
 48    }
 49}