public void EnabledCanvasGroupOnACanvasEffectAllChildrenAlpha() { // Set up the states of the canvas groups for the tests. SetUpCanvasGroupState(); // With no enabled CanvasGroup the Alphas should be 1 Assert.AreEqual(1.0f, m_ChildCanvasRenderer.GetInheritedAlpha()); Assert.AreEqual(1.0f, m_GrandChildCanvasRenderer.GetInheritedAlpha()); // Children under a different nest canvas should also obey the alpha Assert.AreEqual(1.0f, m_ChildCanvasTwoRenderer.GetInheritedAlpha()); // Enable the Canvas CanvasGroup. All of the Canvas children should now have the same alpha value. m_CanvasGroup.enabled = true; Assert.AreEqual(m_CanvasAlpha, m_ChildCanvasRenderer.GetInheritedAlpha()); Assert.AreEqual(m_CanvasAlpha, m_GrandChildCanvasRenderer.GetInheritedAlpha()); // Children under a different nest canvas should also obey the alpha Assert.AreEqual(m_CanvasAlpha, m_ChildCanvasTwoRenderer.GetInheritedAlpha()); }
public void EnabledCanvasGroupEffectSelfAndChildrenAlpha() { // Set up the states of the canvas groups for the tests. SetUpCanvasGroupState(); // With no enabled CanvasGroup the Alphas should be 1 Assert.AreEqual(1.0f, m_ChildCanvasRenderer.GetInheritedAlpha()); Assert.AreEqual(1.0f, m_GrandChildCanvasRenderer.GetInheritedAlpha()); // Enable the child CanvasGroup. It and its children should now have the same alpha value. m_ChildCanvasGroup.enabled = true; Assert.AreEqual(m_ChildAlpha, m_ChildCanvasRenderer.GetInheritedAlpha()); Assert.AreEqual(m_ChildAlpha, m_GrandChildCanvasRenderer.GetInheritedAlpha()); }