Skip to content

Commit

Permalink
enable dialog tests
Browse files Browse the repository at this point in the history
  • Loading branch information
taluks committed Nov 6, 2019
1 parent 15eda21 commit 5460822
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions overlap2d/test/java/com/commons/O2DDialogTest.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package com.commons;

import com.badlogic.gdx.Gdx;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.number.OrderingComparison.greaterThan;
import static org.junit.Assert.assertThat;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.widget.VisImageButton;
import com.kotcrab.vis.ui.widget.VisTextField;
import com.kotcrab.vis.ui.widget.VisValidatableTextField;
import com.runner.LibgdxRunner;
import com.runner.NeedGL;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.number.OrderingComparison.greaterThan;
import static org.junit.Assert.assertThat;

/**
* TODO: enable this test back when possible
Expand All @@ -28,40 +31,39 @@ public class O2DDialogTest {

@Before
public void setUp() throws Exception {
//VisUI.load(Gdx.files.local("overlap2d/assets/style/uiskin.json"));
//o2DDialog = new O2DDialog("O2DDialog Test");
o2DDialog = new O2DDialog("O2DDialog Test");
}

@Test
@NeedGL
public void shouldCreateTextFieldWithGivenText() throws Exception {
/*VisTextField textField = o2DDialog.createTextField("givenText");
VisTextField textField = o2DDialog.createTextField("givenText");

assertThat(textField, not(nullValue()));
assertThat(textField.getText(), is("givenText"));
assertThat(textField.getListeners().size, greaterThan(0));*/
assertThat(textField.getListeners().size, greaterThan(0));
}

@Test
@NeedGL
public void shouldCreateVisValidatableTextFieldWithInputValidator() throws Exception {
/*VisValidatableTextField visValidatableTextField = o2DDialog.createValidableTextField("inputText", input -> true);
VisValidatableTextField visValidatableTextField = o2DDialog.createValidableTextField("inputText", input -> true);

assertThat(visValidatableTextField, not(nullValue()));
assertThat(visValidatableTextField.getText(), is("inputText"));
assertThat(visValidatableTextField.getListeners().size, greaterThan(0));*/
assertThat(visValidatableTextField.getListeners().size, greaterThan(0));
}

@Test
@NeedGL
public void shouldAddCloseButton() throws Exception {
/*o2DDialog.addCloseButton();
o2DDialog.addCloseButton();

Table titleTable = o2DDialog.getTitleTable();
assertThat(titleTable.getCells().size, is(2));
assertThat(titleTable.getCells(), hasItems(
hasProperty("actor", instanceOf(Label.class)),
hasProperty("actor", instanceOf(VisImageButton.class))));
*/

}
}

0 comments on commit 5460822

Please sign in to comment.