Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.codename1.charts.compat;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import com.codename1.ui.Component;
import com.codename1.ui.Stroke;
import org.junit.jupiter.api.Assertions;

public class PaintCompatTest extends UITestBase {

@FormTest
public void testAlign() {
Assertions.assertEquals(Component.CENTER, Paint.Align.CENTER);
Assertions.assertEquals(Component.LEFT, Paint.Align.LEFT);
Assertions.assertEquals(Component.RIGHT, Paint.Align.RIGHT);
Paint.Align align = new Paint.Align();
Assertions.assertNotNull(align);
}

@FormTest
public void testCap() {
Assertions.assertEquals(Stroke.CAP_BUTT, Paint.Cap.BUTT);
Assertions.assertEquals(Stroke.CAP_ROUND, Paint.Cap.ROUND);
Assertions.assertEquals(Stroke.CAP_SQUARE, Paint.Cap.SQUARE);
Paint.Cap cap = new Paint.Cap();
Assertions.assertNotNull(cap);
}

@FormTest
public void testJoin() {
Assertions.assertEquals(Stroke.JOIN_BEVEL, Paint.Join.BEVEL);
Assertions.assertEquals(Stroke.JOIN_MITER, Paint.Join.MITER);
Assertions.assertEquals(Stroke.JOIN_ROUND, Paint.Join.ROUND);
Paint.Join join = new Paint.Join();
Assertions.assertNotNull(join);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codename1.charts.renderers;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import org.junit.jupiter.api.Assertions;

public class DialRendererTypeTest extends UITestBase {

@FormTest
public void testEnum() {
Assertions.assertEquals(DialRenderer.Type.NEEDLE, DialRenderer.Type.valueOf("NEEDLE"));
Assertions.assertEquals(DialRenderer.Type.ARROW, DialRenderer.Type.valueOf("ARROW"));
Assertions.assertEquals(2, DialRenderer.Type.values().length);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codename1.io;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import org.junit.jupiter.api.Assertions;

public class Oauth2RefreshTokenRequestTest extends UITestBase {

@FormTest
public void testRefreshTokenRequest() {
// Just instantiate to cover the class definition
Oauth2.RefreshTokenRequest req = new Oauth2("url", "id", "uri").new RefreshTokenRequest();
Assertions.assertNotNull(req);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codename1.javascript;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import org.junit.jupiter.api.Assertions;

public class JSExceptionTest extends UITestBase {

@FormTest
public void testConstructor() {
JSException ex = new JSException("Test message");
Assertions.assertEquals("Test message", ex.getMessage());
Assertions.assertTrue(ex instanceof RuntimeException);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codename1.ui;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import org.junit.jupiter.api.Assertions;

public class BlockingDisallowedExceptionTest extends UITestBase {

@FormTest
public void testConstructor() {
BlockingDisallowedException ex = new BlockingDisallowedException();
Assertions.assertEquals("Attempt to run invokeAndBlock while blocking is disabled.", ex.getMessage());
Assertions.assertTrue(ex instanceof IllegalStateException);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.codename1.ui;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import com.codename1.ui.layouts.BorderLayout;
import org.junit.jupiter.api.Assertions;

public class SheetCoverageTest extends UITestBase {

@FormTest
public void testSheetStaticMethods() {
// Setup a form with a Sheet
Form form = Display.getInstance().getCurrent();
form.setLayout(new BorderLayout());

Sheet sheet = new Sheet(null, "Test Sheet");
sheet.show(0);

// This should trigger getCurrentSheet() logic
Sheet current = Sheet.getCurrentSheet();
Assertions.assertEquals(sheet, current);

// This should trigger findContainingSheet() logic
Label content = new Label("Content");
sheet.getContentPane().add(content);

Sheet found = Sheet.findContainingSheet(content);
Assertions.assertEquals(sheet, found);

// Test null cases
Assertions.assertNull(Sheet.findContainingSheet(form));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.codename1.ui.layouts.mig;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import org.junit.jupiter.api.Assertions;

public class UnitConverterTest extends UITestBase {

@FormTest
public void testConstantsAndImpl() {
Assertions.assertEquals(-87654312, UnitConverter.UNABLE);

UnitConverter converter = new UnitConverter() {
@Override
public int convertToPixels(float value, String unit, boolean isHor, float refValue, ContainerWrapper parent, ComponentWrapper comp) {
return (int) value;
}
};

Assertions.assertEquals(10, converter.convertToPixels(10.5f, "px", true, 0, null, null));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codename1.util.regex;

import com.codename1.junit.FormTest;
import com.codename1.junit.UITestBase;
import org.junit.jupiter.api.Assertions;

public class RESyntaxExceptionTest extends UITestBase {

@FormTest
public void testConstructor() {
RESyntaxException ex = new RESyntaxException("Invalid regex");
Assertions.assertEquals("Syntax error: Invalid regex", ex.getMessage());
Assertions.assertTrue(ex instanceof RuntimeException);
}
}
4 changes: 2 additions & 2 deletions maven/java-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<artifactId>maven-compiler-plugin</artifactId>

<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Expand Down
Loading