-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INTERNAL] CsvTableEditorState test added
- Loading branch information
1 parent
d7ed638
commit e22d1d2
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...test/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditorStateTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.seesharpsoft.intellij.plugins.csv.editor.table; | ||
|
||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; | ||
import net.seesharpsoft.intellij.plugins.csv.editor.CsvEditorSettingsExternalizable; | ||
import org.jdom.Element; | ||
|
||
public class CsvTableEditorStateTest extends LightCodeInsightFixtureTestCase { | ||
|
||
@Override | ||
protected String getTestDataPath() { | ||
return "./src/test/resources/editor"; | ||
} | ||
|
||
@Override | ||
protected void setUp() throws Exception { | ||
super.setUp(); | ||
CsvEditorSettingsExternalizable.getInstance().loadState(new CsvEditorSettingsExternalizable.OptionSet()); | ||
myFixture.configureByFiles("AnyFile.csv"); | ||
} | ||
|
||
public void testCsvTableEditorStateSerializationAndDeserialization() { | ||
Element domElement = new Element("dummy"); | ||
CsvTableEditorState originalTableEditorState = new CsvTableEditorState(); | ||
|
||
originalTableEditorState.setColumnWidths(new int[] { 100, 50, 200, 42}); | ||
originalTableEditorState.setRowLines(42); | ||
originalTableEditorState.setFixedHeaders(!originalTableEditorState.getFixedHeaders()); | ||
originalTableEditorState.setShowInfoPanel(!originalTableEditorState.showInfoPanel()); | ||
|
||
originalTableEditorState.write(getProject(), domElement); | ||
|
||
CsvTableEditorState deserializeEditorState = CsvTableEditorState.create(domElement, this.getProject(), this.getFile().getVirtualFile()); | ||
|
||
assertOrderedEquals(deserializeEditorState.getColumnWidths(), originalTableEditorState.getColumnWidths()); | ||
assertEquals(originalTableEditorState.getRowLines(), deserializeEditorState.getRowLines()); | ||
assertEquals(originalTableEditorState.getFixedHeaders(), deserializeEditorState.getFixedHeaders()); | ||
assertEquals(originalTableEditorState.showInfoPanel(), deserializeEditorState.showInfoPanel()); | ||
} | ||
} |