Search in sources :

Example 26 with EditableBinaryData

use of org.exbin.utils.binary_data.EditableBinaryData in project deltahex-java by exbin.

the class ExtendedCodeAreaTest method testCopyPasteAtTheEnd.

@Test
public void testCopyPasteAtTheEnd() {
    CodeArea codeArea = new CodeArea();
    EditableBinaryData sampleData = getSampleData(SAMPLE_ALLBYTES);
    codeArea.setData(sampleData);
    long dataSize = sampleData.getDataSize();
    codeArea.selectAll();
    codeArea.copy();
    codeArea.clearSelection();
    ((CaretCapable) codeArea.getWorker()).getCaret().setCaretPosition(dataSize / 2);
    codeArea.paste();
    Assert.assertTrue(codeArea.getDataSize() == (dataSize / 2 + dataSize));
}
Also used : EditableBinaryData(org.exbin.utils.binary_data.EditableBinaryData) Test(org.junit.Test)

Example 27 with EditableBinaryData

use of org.exbin.utils.binary_data.EditableBinaryData in project deltahex-java by exbin.

the class ExtendedCodeAreaTest method testCopyPasteInOverwriteMode.

@Test
public void testCopyPasteInOverwriteMode() {
    CodeArea codeArea = new CodeArea();
    EditableBinaryData sampleData = getSampleData(SAMPLE_ALLBYTES);
    codeArea.setData(sampleData);
    long dataSize = sampleData.getDataSize();
    codeArea.selectAll();
    codeArea.copy();
    codeArea.clearSelection();
    codeArea.paste();
    Assert.assertTrue(codeArea.getDataSize() == dataSize);
}
Also used : EditableBinaryData(org.exbin.utils.binary_data.EditableBinaryData) Test(org.junit.Test)

Aggregations

EditableBinaryData (org.exbin.utils.binary_data.EditableBinaryData)27 Test (org.junit.Test)11 IOException (java.io.IOException)10 FileInputStream (java.io.FileInputStream)8 InputStream (java.io.InputStream)5 BinaryData (org.exbin.utils.binary_data.BinaryData)5 JFileChooser (javax.swing.JFileChooser)3 EditationModeCapable (org.exbin.deltahex.capability.EditationModeCapable)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 Charset (java.nio.charset.Charset)2 FileFilter (javax.swing.filechooser.FileFilter)2 CaretPosition (org.exbin.deltahex.CaretPosition)2 CodeType (org.exbin.deltahex.CodeType)2 CharsetCapable (org.exbin.deltahex.capability.CharsetCapable)2 DeltaHexExampleBasicPanel (org.exbin.deltahex.swing.example.DeltaHexExampleBasicPanel)2 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 FileOutputStream (java.io.FileOutputStream)1 SelectionRange (org.exbin.deltahex.SelectionRange)1 CaretCapable (org.exbin.deltahex.capability.CaretCapable)1