< Summary

Class:APK_GLTF_InteractiveTest
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/GLTF/TestScene/APK_GLTF_InteractiveTest.cs
Covered lines:0
Uncovered lines:32
Coverable lines:32
Total lines:69
Line coverage:0% (0 of 32)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
APK_GLTF_InteractiveTest()0%2100%
Start()0%2100%
Generate(...)0%2100%
Update()0%56700%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/GLTF/TestScene/APK_GLTF_InteractiveTest.cs

#LineLine coverage
 1using DCL;
 2using DCL.Helpers;
 3using System.Collections.Generic;
 4using UnityEngine;
 5using UnityGLTF;
 6
 7public class APK_GLTF_InteractiveTest : MonoBehaviour
 8{
 9    ContentProvider_Dummy provider;
 10    AssetPromiseKeeper_GLTF keeper;
 11
 012    List<AssetPromise_GLTF> promiseList = new List<AssetPromise_GLTF>();
 13
 14    void Start()
 15    {
 016        GLTFSceneImporter.budgetPerFrameInMilliseconds = 4;
 17
 018        provider = new ContentProvider_Dummy();
 019        keeper = new AssetPromiseKeeper_GLTF();
 020    }
 21
 22    void Generate(string url)
 23    {
 024        AssetPromise_GLTF promise = new AssetPromise_GLTF(provider, url);
 25
 026        Vector3 pos = Vector3.zero;
 027        pos.x = Random.Range(-10, 10);
 028        pos.z = Random.Range(-10, 10);
 029        promise.settings.initialLocalPosition = pos;
 30
 031        keeper.Keep(promise);
 032        promiseList.Add(promise);
 033    }
 34    static int counter = 0;
 35    void Update()
 36    {
 037        if (Input.GetKeyUp(KeyCode.Z))
 38        {
 039            counter++;
 040            counter %= 3;
 041            switch (counter)
 42            {
 43                case 0:
 044                    string url = TestAssetsUtils.GetPath() + "/GLB/TrunkSeparatedTextures/Trunk.glb";
 045                    Generate(url);
 046                    break;
 47                case 1:
 048                    string url2 = TestAssetsUtils.GetPath() + "/GLB/Lantern/Lantern.glb";
 049                    Generate(url2);
 050                    break;
 51                case 2:
 052                    string url3 = TestAssetsUtils.GetPath() + "/GLB/DamagedHelmet/DamagedHelmet.glb";
 053                    Generate(url3);
 054                    break;
 55            }
 56
 57        }
 058        else if (Input.GetKeyUp(KeyCode.X))
 59        {
 060            if (promiseList.Count > 0)
 61            {
 062                var promiseToRemove = promiseList[Random.Range(0, promiseList.Count)];
 063                keeper.Forget(promiseToRemove);
 064                promiseList.Remove(promiseToRemove);
 65            }
 66        }
 67
 068    }
 69}