You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MainFrameTest.java 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.addons.ui_swing;
  23. import com.dmdirc.harness.ui.DMDircUITestCase;
  24. import org.junit.Test;
  25. import org.uispec4j.Window;
  26. import org.uispec4j.interception.WindowInterceptor;
  27. public class MainFrameTest extends DMDircUITestCase {
  28. private static Window window;
  29. static {
  30. SwingController controller = getMockedController();
  31. window = new Window(new MainFrame(controller));
  32. window.containsMenuBar().check();
  33. }
  34. @Test
  35. public void testNewServerDialog() {
  36. Window popup = WindowInterceptor.run(window.getMenuBar()
  37. .getMenu("Server").getSubMenu("New Server...").triggerClick());
  38. popup.titleEquals("DMDirc: Connect to a new server").check();
  39. }
  40. @Test
  41. public void testAboutDialog() {
  42. Window popup = WindowInterceptor.run(window.getMenuBar()
  43. .getMenu("Help").getSubMenu("About").triggerClick());
  44. popup.titleEquals("DMDirc: About").check();
  45. }
  46. @Test
  47. public void testFeedbackDialog() {
  48. Window popup = WindowInterceptor.run(window.getMenuBar()
  49. .getMenu("Help").getSubMenu("Send Feedback").triggerClick());
  50. popup.titleEquals("DMDirc: Feedback").check();
  51. }
  52. @Test
  53. public void testPreferencesDialog() {
  54. Window popup = WindowInterceptor.run(window.getMenuBar()
  55. .getMenu("Settings").getSubMenu("Preferences").triggerClick());
  56. popup.titleEquals("DMDirc: Preferences").check();
  57. }
  58. @Test
  59. public void testProfileManagerDialog() {
  60. Window popup = WindowInterceptor.run(window.getMenuBar()
  61. .getMenu("Settings").getSubMenu("Profile Manager").triggerClick());
  62. popup.titleEquals("DMDirc: Profile Editor").check();
  63. }
  64. @Test
  65. public void testActionsManagerDialog() {
  66. Window popup = WindowInterceptor.run(window.getMenuBar()
  67. .getMenu("Settings").getSubMenu("Actions Manager").triggerClick());
  68. popup.titleEquals("DMDirc: Actions Manager").check();
  69. }
  70. @Test
  71. public void testAliasManagerDialog() {
  72. Window popup = WindowInterceptor.run(window.getMenuBar()
  73. .getMenu("Settings").getSubMenu("Alias Manager").triggerClick());
  74. popup.titleEquals("DMDirc: Alias manager").check();
  75. }
  76. @Test
  77. public void testChannelServerSettings() {
  78. assertFalse(window.getMenuBar().getMenu("Channel").getSubMenu("Channel Settings").isEnabled());
  79. }
  80. @Test
  81. public void testServerServerSettings() {
  82. assertFalse(window.getMenuBar().getMenu("Server").getSubMenu("Server Settings").isEnabled());
  83. }
  84. }