Skip to content
Permalink
Browse files
8265439: [TestBug] Enable and fix ignored unit tests in MenuItemTest
Reviewed-by: kcr
  • Loading branch information
aghaisas committed Apr 20, 2021
1 parent e02cee9 commit af75a1fb44be39fe777f64eec19fd0bd14b0008e
Showing 1 changed file with 7 additions and 25 deletions.
@@ -58,7 +58,6 @@

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;


@@ -228,20 +227,14 @@ public class MenuItemTest {
@Test public void getUnspecifiedTextProperty1() {
MenuItem mi2 = new MenuItem();
assertNotNull(mi2.textProperty());
assertNull(mi2.getText());
}

@Test public void getUnspecifiedTextProperty2() {
MenuItem mi2 = new MenuItem("");
assertEquals("", mi2.getText());
}

@Ignore // calling textProperty will no ensure text value is non null
@Test public void unsetTextButNotNull() {
MenuItem mi2 = new MenuItem();
mi2.textProperty();
assertNotNull(mi2.getText());
}

@Test public void textCanBeBound() {
SimpleStringProperty other = new SimpleStringProperty(menuItem, "text", "Goodbye");
menuItem.textProperty().bind(other);
@@ -275,19 +268,13 @@ public class MenuItemTest {
@Test public void getUnspecifiedGraphicProperty1() {
MenuItem mi2 = new MenuItem();
assertNotNull(mi2.graphicProperty());
assertNull(mi2.getGraphic());
}

@Test public void getUnspecifiedGraphicProperty2() {
MenuItem mi2 = new MenuItem("",null);
assertNotNull(mi2.graphicProperty());
}

@Ignore // Again, calling graphicPropery() is not ensuring a non null graphic
// node.
@Test public void unsetGraphicButNotNull() {
MenuItem mi2 = new MenuItem();
mi2.graphicProperty();
assertNotNull(mi2.getGraphic());
assertNull(mi2.getGraphic());
}

@Test public void graphicCanBeBound() {
@@ -419,18 +406,16 @@ public static final class EventHandlerStub implements EventHandler<ActionEvent>
assertEquals(other.get(), menuItem.isVisible());
}

@Ignore // keyCharacter for keyCodeCombination cannot be null
@Test public void setSpecifiedAccelerator1() {
Modifier[] modifierArray = {};
KeyCombination kc = new KeyCodeCombination(null, modifierArray);
KeyCombination kc = new KeyCodeCombination(KeyCode.A, modifierArray);
menuItem.setAccelerator(kc);
assertEquals(kc, menuItem.getAccelerator());
}

@Ignore // keyCharacter for keyCodeCombination cannot be null
@Test public void setSpecifiedAccelerator2() {
Modifier[] modifierArray = {};
KeyCombination kc = new KeyCharacterCombination(null, modifierArray);
KeyCombination kc = new KeyCharacterCombination("A", modifierArray);
menuItem.setAccelerator(kc);
assertEquals(kc, menuItem.getAccelerator());
}
@@ -453,18 +438,15 @@ public static final class EventHandlerStub implements EventHandler<ActionEvent>
assertNotNull(menuItem.acceleratorProperty());
}

@Ignore // keyCharacter cannot be null for keyCharacterCombination
@Test public void acceleratorCanBeBound() {
Modifier[] modifierArray = {};
KeyCombination kc = new KeyCharacterCombination(null, modifierArray);
KeyCombination kc = new KeyCharacterCombination("A", KeyCombination.ALT_DOWN);
SimpleObjectProperty<KeyCombination> other = new SimpleObjectProperty<KeyCombination>(menuItem, "accelerator", kc);
menuItem.acceleratorProperty().bind(other);
assertEquals(kc, menuItem.getAccelerator());
}

@Ignore
@Test public void getUnspecifiedMnemonicParsing() {
assertEquals(false, menuItem.isMnemonicParsing());
assertEquals(true, menuItem.isMnemonicParsing());
}

@Test public void setTrueMnemonicParsing() {

1 comment on commit af75a1f

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on af75a1f Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.