mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
fixing unit tests related go GP-4289
This commit is contained in:
parent
10f0eb2318
commit
be8c4dde6d
3 changed files with 10 additions and 17 deletions
|
@ -353,9 +353,14 @@ public class ClippingTextField implements TextField {
|
|||
|
||||
@Override
|
||||
public RowColLocation dataToScreenLocation(int dataRow, int dataColumn) {
|
||||
|
||||
int column = textElement.getCharacterIndexForDataLocation(dataRow, dataColumn);
|
||||
if (column < 0) {
|
||||
return new DefaultRowColLocation(0, textElement.length());
|
||||
column = textElement.getCharacterIndexForDataLocation(dataRow, dataColumn - 3);
|
||||
if (column < 0) {
|
||||
return new DefaultRowColLocation(0, textElement.length());
|
||||
}
|
||||
return new RowColLocation(0, textElement.length());
|
||||
}
|
||||
return new RowColLocation(0, column);
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ public class VerticalLayoutTextField implements TextField {
|
|||
return new RowColLocation(i, loc.col());
|
||||
}
|
||||
}
|
||||
// We did not find a match for the given row and column, so return a default location of 0,0
|
||||
|
||||
return new DefaultRowColLocation();
|
||||
}
|
||||
|
||||
|
@ -560,18 +560,6 @@ public class VerticalLayoutTextField implements TextField {
|
|||
return subFields.get(screenRow).field;
|
||||
}
|
||||
|
||||
private FieldRow getFieldRowFromDataRow(int dataRow) {
|
||||
int currentRow = 0;
|
||||
for (FieldRow row : subFields) {
|
||||
int length = row.field.getNumDataRows();
|
||||
if (currentRow + length > dataRow) {
|
||||
return row;
|
||||
}
|
||||
currentRow += length;
|
||||
}
|
||||
return subFields.get(subFields.size() - 1);
|
||||
}
|
||||
|
||||
private int getDataRow(TextField field) {
|
||||
for (FieldRow fieldRow : subFields) {
|
||||
if (fieldRow.field == field) {
|
||||
|
|
|
@ -114,13 +114,13 @@ public class FlowLayoutTextFieldTest extends AbstractGenericTest {
|
|||
assertEquals(new RowColLocation(1, 4), textField.dataToScreenLocation(2, 4));
|
||||
|
||||
// Supercalifra (12 chars); ... (3 chars); Supercalifra... (15 chars)
|
||||
assertEquals(new DefaultRowColLocation(1, 12), textField.dataToScreenLocation(2, 15));
|
||||
assertEquals(new RowColLocation(1, 12), textField.dataToScreenLocation(2, 15));
|
||||
|
||||
assertEquals(new RowColLocation(2, 0), textField.dataToScreenLocation(3, 0));
|
||||
assertEquals(new RowColLocation(2, 4), textField.dataToScreenLocation(3, 4));
|
||||
|
||||
assertEquals(new DefaultRowColLocation(0, 12), textField.dataToScreenLocation(0, 12));
|
||||
assertEquals(new DefaultRowColLocation(0, 12), textField.dataToScreenLocation(0, 75));
|
||||
assertEquals(new DefaultRowColLocation(0, 0), textField.dataToScreenLocation(0, 12));
|
||||
assertEquals(new DefaultRowColLocation(0, 0), textField.dataToScreenLocation(0, 75));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue