mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-206761 ui: fix Presentation copying
A better fix for IDEA-85566, as `getTextWithMnemonic()` now properly escapes returned value.
This commit is contained in:
@@ -354,7 +354,7 @@ public final class Presentation implements Cloneable {
|
||||
if (!Objects.equals(myText, presentation.myText) ||
|
||||
myDisplayedMnemonicIndex != presentation.myDisplayedMnemonicIndex ||
|
||||
myMnemonic != presentation.myMnemonic) {
|
||||
setText(presentation.getTextWithMnemonic(), presentation.myDisplayedMnemonicIndex > -1);
|
||||
setText(presentation.getTextWithMnemonic());
|
||||
}
|
||||
setDescription(presentation.getDescription());
|
||||
setIcon(presentation.getIcon());
|
||||
|
||||
+21
-1
@@ -46,7 +46,7 @@ public class PresentationTest extends LightPlatformTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testPresentationSetText() {
|
||||
public void testSetTextWithUnderscores() {
|
||||
for (Data testCase : data) {
|
||||
Presentation p = new Presentation();
|
||||
p.setText(testCase.inputTextsUnderscore);
|
||||
@@ -55,7 +55,9 @@ public class PresentationTest extends LightPlatformTestCase {
|
||||
assertEquals(testCase.index, p.getDisplayedMnemonicIndex());
|
||||
assertEquals(testCase.fullMenuText, p.getTextWithMnemonic());
|
||||
}
|
||||
}
|
||||
|
||||
public void testSetTextWithAmpersands() {
|
||||
for (Data testCase : data) {
|
||||
Presentation p = new Presentation();
|
||||
p.setText(testCase.inputTextsAmpersand);
|
||||
@@ -66,7 +68,9 @@ public class PresentationTest extends LightPlatformTestCase {
|
||||
|
||||
assertTrue(testCase.menuText.length() > p.getDisplayedMnemonicIndex());
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetTextWithMnemonic() {
|
||||
for (Data testCase : data) {
|
||||
Presentation p1 = new Presentation();
|
||||
p1.setText(testCase.inputTextsUnderscore);
|
||||
@@ -78,7 +82,9 @@ public class PresentationTest extends LightPlatformTestCase {
|
||||
assertEquals(p1.getMnemonic(), p2.getMnemonic());
|
||||
assertEquals(p1.getDisplayedMnemonicIndex(), p2.getDisplayedMnemonicIndex());
|
||||
}
|
||||
}
|
||||
|
||||
public void testMnemonicCharacters() {
|
||||
for (Data testCase : data) {
|
||||
Presentation p1 = new Presentation();
|
||||
p1.setText(testCase.inputTextsAmpersand);
|
||||
@@ -91,6 +97,20 @@ public class PresentationTest extends LightPlatformTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testPresentationCopying() {
|
||||
for (Data testCase : data) {
|
||||
Presentation p1 = new Presentation();
|
||||
p1.setText(testCase.inputTextsUnderscore);
|
||||
|
||||
Presentation p2 = new Presentation();
|
||||
p2.copyFrom(p1);
|
||||
|
||||
assertEquals(p1.getText(), p2.getText());
|
||||
assertEquals(p1.getMnemonic(), p2.getMnemonic());
|
||||
assertEquals(p1.getDisplayedMnemonicIndex(), p2.getDisplayedMnemonicIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
Reference in New Issue
Block a user