< 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
 112  void Start() {
 113    messageBox = gameObject.GetComponent<Text>();
 114    canvasGroup = gameObject.GetComponentInParent<CanvasGroup>();
 115  }
 16
 717  public void RunMessage(String message) {
 718    StartCoroutine(ShowText(message));
 719  }
 20
 721  private IEnumerator ShowText(String message) {
 22        // Set message
 723    messageBox.text = message;
 24
 25        // Fade in message box if not visible
 373826    while(canvasGroup.alpha < 1){
 186627      canvasGroup.alpha += Time.deltaTime * 1f;
 186628      yield return null;
 186529    }
 30
 31        // Wait 5 seconds before fading out
 632    yield return new WaitForSeconds(5f);
 33
 34        // Fade out message box if visible
 364935    while(canvasGroup.alpha > 0){
 182236      canvasGroup.alpha -= Time.deltaTime * 1f;
 182237      yield return null;
 182138    }
 539  }
 40}