Search in sources :

Example 6 with MarkdownViewBot

use of code.satyagraha.gfm.viewer.bots.MarkdownViewBot in project gfm_viewer by satyagraha.

the class MarkdownViewTest method shouldFollowEditorSelectedWhenLinked.

@Test
public void shouldFollowEditorSelectedWhenLinked() throws Exception {
    LOGGER.info("");
    assertThat(MarkdownViewBot.isPresent(), is(false));
    ProjectBot project = ProjectBot.createSimpleProject();
    project.newFile("file1.md");
    project.newFile("file2.md");
    MarkdownViewBot markdownViewBot = MarkdownViewBot.open();
    assertThat(MarkdownViewBot.isPresent(), is(true));
    EditorBot editorBot1 = EditorBot.findByName("file1.md").show();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file1"));
    EditorBot editorBot2 = EditorBot.findByName("file2.md").show();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file2"));
    editorBot2.close();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file1"));
    editorBot1.close();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file1"));
    markdownViewBot.close();
    project.delete();
}
Also used : EditorBot(code.satyagraha.gfm.viewer.bots.EditorBot) ProjectBot(code.satyagraha.gfm.viewer.bots.ProjectBot) MarkdownViewBot(code.satyagraha.gfm.viewer.bots.MarkdownViewBot) Test(org.junit.Test)

Example 7 with MarkdownViewBot

use of code.satyagraha.gfm.viewer.bots.MarkdownViewBot in project gfm_viewer by satyagraha.

the class MarkdownViewTest method shouldNotFollowEditorSelectedWhenNotLinked.

@Test
public void shouldNotFollowEditorSelectedWhenNotLinked() throws Exception {
    LOGGER.info("");
    assertThat(MarkdownViewBot.isPresent(), is(false));
    ProjectBot project = ProjectBot.createSimpleProject();
    project.newFile("file1.md");
    project.newFile("file2.md");
    MarkdownViewBot markdownViewBot = MarkdownViewBot.open();
    assertThat(MarkdownViewBot.isPresent(), is(true));
    SWTBotToolbarButton linkedButton = markdownViewBot.getLinkedButton();
    EditorBot editorBot1 = EditorBot.findByName("file1.md").show();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file1"));
    EditorBot editorBot2 = EditorBot.findByName("file2.md").show();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file2"));
    // set unlinked
    linkedButton.click();
    editorBot2.close();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file2"));
    editorBot1.close();
    SWTUtils.sleep(2000);
    assertThat(markdownViewBot.getTitle(), is("file2"));
    linkedButton.click();
    markdownViewBot.close();
    project.delete();
}
Also used : EditorBot(code.satyagraha.gfm.viewer.bots.EditorBot) ProjectBot(code.satyagraha.gfm.viewer.bots.ProjectBot) MarkdownViewBot(code.satyagraha.gfm.viewer.bots.MarkdownViewBot) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test)

Example 8 with MarkdownViewBot

use of code.satyagraha.gfm.viewer.bots.MarkdownViewBot in project gfm_viewer by satyagraha.

the class MarkdownViewTest method shouldShowPreferencesViaToolbar.

@Test
public void shouldShowPreferencesViaToolbar() throws Exception {
    LOGGER.info("");
    assertThat(MarkdownViewBot.isPresent(), is(false));
    MarkdownViewBot markdownViewBot1 = MarkdownViewBot.open();
    assertThat(MarkdownViewBot.isPresent(), is(true));
    SWTUtils.sleep(2000);
    PreferencesBot preferencesBot = markdownViewBot1.showPreferences();
    preferencesBot.cancel();
    markdownViewBot1.close();
}
Also used : PreferencesBot(code.satyagraha.gfm.viewer.bots.PreferencesBot) MarkdownViewBot(code.satyagraha.gfm.viewer.bots.MarkdownViewBot) Test(org.junit.Test)

Example 9 with MarkdownViewBot

use of code.satyagraha.gfm.viewer.bots.MarkdownViewBot in project gfm_viewer by satyagraha.

the class MarkdownViewTest method shouldOpenThenCloseViewTwice.

@Test
public void shouldOpenThenCloseViewTwice() throws Exception {
    LOGGER.info("");
    assertThat(MarkdownViewBot.isPresent(), is(false));
    MarkdownViewBot markdownViewBot1 = MarkdownViewBot.open();
    assertThat(MarkdownViewBot.isPresent(), is(true));
    markdownViewBot1.close();
    assertThat(MarkdownViewBot.isPresent(), is(false));
    MarkdownViewBot markdownViewBot2 = MarkdownViewBot.open();
    assertThat(MarkdownViewBot.isPresent(), is(true));
    markdownViewBot2.close();
    assertThat(MarkdownViewBot.isPresent(), is(false));
}
Also used : MarkdownViewBot(code.satyagraha.gfm.viewer.bots.MarkdownViewBot) Test(org.junit.Test)

Aggregations

MarkdownViewBot (code.satyagraha.gfm.viewer.bots.MarkdownViewBot)9 Test (org.junit.Test)9 ProjectBot (code.satyagraha.gfm.viewer.bots.ProjectBot)7 EditorBot (code.satyagraha.gfm.viewer.bots.EditorBot)4 ProjectFileBot (code.satyagraha.gfm.viewer.bots.ProjectBot.ProjectFileBot)3 SWTBotToolbarButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 PreferencesBot (code.satyagraha.gfm.viewer.bots.PreferencesBot)1