< Summary

Class:ShowMessage
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/ShowMessage.cs
Covered lines:19
Uncovered lines:0
Coverable lines:19
Total lines:40
Line coverage:100% (19 of 19)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%000100%
RunMessage(...)0%000100%
ShowText()0%000100%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/EscapeTheRoomVR/Assets/Test 1/ShowMessage.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.UI;
 3using System.Collections;
 4using System;
 5using UnityEngine.SceneManagement;
 6
 7class ShowMessage : MonoBehaviour {
 8  private Text messageBox;
 9  private CanvasGroup canvasGroup;
 10
 11    // Get necessary components at start
 212  void Start() {
 213    messageBox = gameObject.GetComponent<Text>();
 214    canvasGroup = gameObject.GetComponentInParent<CanvasGroup>();
 215  }
 16
 1117  public void RunMessage(String message) {
 1118    StartCoroutine(ShowText(message));
 1119  }
 20
 1121  private IEnumerator ShowText(String message) {
 22        // Set message
 1123    messageBox.text = message;
 24
 25        // Fade in message box if not visible
 1856726    while(canvasGroup.alpha < 1){
 927927      canvasGroup.alpha += Time.deltaTime * 1f;
 927928      yield return null;
 927729    }
 30
 31        // Wait 5 seconds before fading out
 932    yield return new WaitForSeconds(5f);
 33
 34        // Fade out message box if visible
 1864535    while(canvasGroup.alpha > 0){
 931936      canvasGroup.alpha -= Time.deltaTime * 1f;
 931937      yield return null;
 931738    }
 739  }
 40}