public IEnumerator OpenFriendsHUDOnBackButtonPressed() { IChatController chatController = Substitute.For <IChatController>(); chatController.GetEntries().ReturnsForAnyArgs(new List <ChatMessage>()); InitializeChatWindowController(chatController); // Initialize friends HUD NotificationsController.i.Initialize(new NotificationHUDController()); FriendsHUDController friendsHudController = new FriendsHUDController(); friendsHudController.Initialize(new FriendsController_Mock(), UserProfile.GetOwnUserProfile()); Assert.IsTrue(view != null, "Friends hud view is null?"); Assert.IsTrue(controller != null, "Friends hud controller is null?"); // initialize private chat controller.SetVisibility(true); Assert.AreEqual(true, controller.view.gameObject.activeSelf); controller.view.backButton.onClick.Invoke(); yield return(null); Assert.AreEqual(true, friendsHudController.view.gameObject.activeSelf); friendsHudController.Dispose(); NotificationsController.i.Dispose(); }
public void AddFriendWindowProperly() { friendsHudController = new FriendsHUDController(); friendsHudController.Initialize(null, null); controller.AddFriendsWindow(friendsHudController); Assert.IsTrue(friendsHudController.view.transform.parent == view.leftWindowContainer, "Friends window isn't inside taskbar window container!"); Assert.IsTrue(friendsHudController.view.gameObject.activeSelf, "Friends window is disabled!"); }
protected override IEnumerator SetUp() { yield return(base.SetUp()); controller = new FriendsHUDController(); controller.Initialize(null, null); this.view = controller.view; Assert.IsTrue(view != null, "Friends hud view is null?"); Assert.IsTrue(controller != null, "Friends hud controller is null?"); }
protected override IEnumerator SetUp() { yield return(base.SetUp()); NotificationsController.i.Initialize(new NotificationHUDController()); controller = new FriendsHUDController(); friendsController = new FriendsController_Mock(); controller.Initialize(friendsController, UserProfile.GetOwnUserProfile()); this.view = controller.view; Assert.IsTrue(view != null, "Friends hud view is null?"); Assert.IsTrue(controller != null, "Friends hud controller is null?"); }
public IEnumerator OpenFriendsHUDOnBackButtonPressed() { // Initialize friends HUD NotificationsController.i.Initialize(new NotificationHUDController()); var friendsHUDController = new FriendsHUDController(); friendsHUDController.Initialize(new FriendsController_Mock(), UserProfile.GetOwnUserProfile()); Assert.IsTrue(view != null, "Friends hud view is null?"); Assert.IsTrue(controller != null, "Friends hud controller is null?"); // initialie private chat controller.SetVisibility(true); Assert.AreEqual(true, controller.view.gameObject.activeSelf); controller.view.backButton.onClick.Invoke(); yield return(null); Assert.AreEqual(true, friendsHUDController.view.gameObject.activeSelf); }
public void ToggleWindowsProperly() { privateChatController = new PrivateChatWindowHUDController(); privateChatController.Initialize(chatController); controller.AddPrivateChatWindow(privateChatController); const string badPositionMsg = "Anchored position should be zero or it won't be correctly placed inside the taskbar"; const string badPivotMsg = "Pivot should be zero or it won't be correctly placed inside the taskbar"; RectTransform rt = privateChatController.view.transform as RectTransform; Assert.AreEqual(Vector2.zero, rt.anchoredPosition, badPositionMsg); Assert.AreEqual(Vector2.zero, rt.pivot, badPivotMsg); worldChatWindowController = new WorldChatWindowHUDController(); worldChatWindowController.Initialize(chatController, null); controller.AddWorldChatWindow(worldChatWindowController); rt = worldChatWindowController.view.transform as RectTransform; Assert.AreEqual(Vector2.zero, rt.anchoredPosition, badPositionMsg); Assert.AreEqual(Vector2.zero, rt.pivot, badPivotMsg); friendsHudController = new FriendsHUDController(); friendsHudController.Initialize(friendsController, UserProfile.GetOwnUserProfile()); controller.AddFriendsWindow(friendsHudController); rt = friendsHudController.view.transform as RectTransform; Assert.AreEqual(Vector2.zero, rt.anchoredPosition, badPositionMsg); Assert.AreEqual(Vector2.zero, rt.pivot, badPivotMsg); TestHelpers_Friends.FakeAddFriend(friendsController, friendsHudController.view, "test-1"); TestHelpers_Chat.FakePrivateChatMessageFrom(chatController, "test-1", "test message!"); var buttonList = view.GetButtonList(); Assert.AreEqual(8, buttonList.Count, "Chat head is missing when receiving a private message?"); Assert.IsFalse(view.chatButton.toggledOn); Assert.IsTrue(buttonList[2] is ChatHeadButton); ChatHeadButton headButton = buttonList[2] as ChatHeadButton; Assert.IsFalse(headButton.toggledOn); //NOTE(Brian): Toggle chat head on and test it works as intended headButton.toggleButton.onClick.Invoke(); Assert.IsTrue(headButton.lineOnIndicator.isVisible); Assert.IsFalse(view.friendsButton.lineOnIndicator.isVisible); Assert.IsFalse(view.chatButton.lineOnIndicator.isVisible); Assert.IsTrue(controller.privateChatWindowHud.view.gameObject.activeInHierarchy); //NOTE(Brian): Toggle friends window on and test all other windows are untoggled view.friendsButton.toggleButton.onClick.Invoke(); Assert.IsFalse(controller.privateChatWindowHud.view.gameObject.activeInHierarchy); Assert.IsFalse(headButton.lineOnIndicator.isVisible); Assert.IsTrue(view.friendsButton.lineOnIndicator.isVisible); Assert.IsFalse(view.chatButton.lineOnIndicator.isVisible); //NOTE(Brian): Toggle friends window off and test all other windows are untoggled view.friendsButton.toggleButton.onClick.Invoke(); Assert.IsFalse(controller.privateChatWindowHud.view.gameObject.activeInHierarchy); Assert.IsFalse(headButton.lineOnIndicator.isVisible); Assert.IsFalse(view.friendsButton.lineOnIndicator.isVisible); //NOTE(Brian): Toggle friends on, and then chat button on. Then check if world chat window is showing up. view.friendsButton.toggleButton.onClick.Invoke(); view.chatButton.toggleButton.onClick.Invoke(); Assert.IsTrue(controller.worldChatWindowHud.view.gameObject.activeInHierarchy); Assert.IsFalse(controller.friendsHud.view.gameObject.activeInHierarchy); Assert.IsFalse(view.friendsButton.lineOnIndicator.isVisible); }