Search in sources :

Example 1 with FileHistoryDialogModel

use of com.intellij.history.integration.ui.models.FileHistoryDialogModel in project intellij-community by JetBrains.

the class FileHistoryDialogTest method testTitles.

public void testTitles() throws IOException {
    long leftTime = new Date(2001 - 1900, 1, 3, 12, 0).getTime();
    long rightTime = new Date(2002 - 1900, 2, 4, 14, 0).getTime();
    VirtualFile f = createChildData(myRoot, "old.txt");
    setBinaryContent(f, "old".getBytes(), -1, leftTime, this);
    rename(f, "new.txt");
    setBinaryContent(f, "new".getBytes(), -1, rightTime, this);
    byte[] content = new byte[0];
    setBinaryContent(f, content);
    FileHistoryDialogModel m = createFileModelAndSelectRevisions(f, 0, 2);
    assertEquals(FileUtil.toSystemDependentName(f.getPath()), m.getDifferenceModel().getTitle());
    assertEquals(DateFormatUtil.formatPrettyDateTime(leftTime) + " - old.txt", m.getDifferenceModel().getLeftTitle(new NullRevisionsProgress()));
    assertEquals(DateFormatUtil.formatPrettyDateTime(rightTime) + " - new.txt", m.getDifferenceModel().getRightTitle(new NullRevisionsProgress()));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) NullRevisionsProgress(com.intellij.history.integration.ui.models.NullRevisionsProgress) EntireFileHistoryDialogModel(com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel) FileHistoryDialogModel(com.intellij.history.integration.ui.models.FileHistoryDialogModel) Date(java.util.Date)

Example 2 with FileHistoryDialogModel

use of com.intellij.history.integration.ui.models.FileHistoryDialogModel in project intellij-community by JetBrains.

the class FileHistoryDialogTest method testContentWhenOnlyOneRevisionSelected.

public void testContentWhenOnlyOneRevisionSelected() throws IOException {
    VirtualFile f = createChildData(myRoot, "f.txt");
    setBinaryContent(f, "old".getBytes());
    setBinaryContent(f, "new".getBytes());
    FileHistoryDialogModel m = createFileModelAndSelectRevisions(f, 0, 0);
    assertDiffContents("old", "new", m);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EntireFileHistoryDialogModel(com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel) FileHistoryDialogModel(com.intellij.history.integration.ui.models.FileHistoryDialogModel)

Example 3 with FileHistoryDialogModel

use of com.intellij.history.integration.ui.models.FileHistoryDialogModel in project intellij-community by JetBrains.

the class FileHistoryDialogTest method testContent.

public void testContent() throws IOException {
    VirtualFile f = createChildData(myRoot, "f.txt");
    setBinaryContent(f, "old".getBytes());
    setBinaryContent(f, "new".getBytes());
    setBinaryContent(f, "current".getBytes());
    FileHistoryDialogModel m = createFileModelAndSelectRevisions(f, 0, 1);
    assertDiffContents("old", "new", m);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EntireFileHistoryDialogModel(com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel) FileHistoryDialogModel(com.intellij.history.integration.ui.models.FileHistoryDialogModel)

Example 4 with FileHistoryDialogModel

use of com.intellij.history.integration.ui.models.FileHistoryDialogModel in project intellij-community by JetBrains.

the class FileHistoryDialogTest method createFileModelAndSelectRevisions.

private FileHistoryDialogModel createFileModelAndSelectRevisions(VirtualFile f, int first, int second) {
    FileHistoryDialogModel m = createFileModel(f);
    m.selectRevisions(first, second);
    return m;
}
Also used : EntireFileHistoryDialogModel(com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel) FileHistoryDialogModel(com.intellij.history.integration.ui.models.FileHistoryDialogModel)

Example 5 with FileHistoryDialogModel

use of com.intellij.history.integration.ui.models.FileHistoryDialogModel in project intellij-community by JetBrains.

the class FileHistoryDialogTest method testContentForCurrentRevision.

public void testContentForCurrentRevision() throws IOException {
    VirtualFile f = createChildData(myRoot, "f.txt");
    setBinaryContent(f, "old".getBytes());
    setBinaryContent(f, "current".getBytes());
    FileHistoryDialogModel m = createFileModelAndSelectRevisions(f, 0, 0);
    assertDiffContents("old", "current", m);
    assertTrue(getRightDiffContent(m) instanceof DocumentContent);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DocumentContent(com.intellij.diff.contents.DocumentContent) EntireFileHistoryDialogModel(com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel) FileHistoryDialogModel(com.intellij.history.integration.ui.models.FileHistoryDialogModel)

Aggregations

EntireFileHistoryDialogModel (com.intellij.history.integration.ui.models.EntireFileHistoryDialogModel)6 FileHistoryDialogModel (com.intellij.history.integration.ui.models.FileHistoryDialogModel)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 DocumentContent (com.intellij.diff.contents.DocumentContent)1 NullRevisionsProgress (com.intellij.history.integration.ui.models.NullRevisionsProgress)1 Date (java.util.Date)1