forked from jMonkeyEngine/jmonkeyengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jMonkeyEngine#2279 Add a test for BitmapText3D
- Loading branch information
1 parent
f9894c1
commit e87071c
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...creenshot-tests/src/test/java/org/jmonkeyengine/screenshottests/gui/TestBitmapText3D.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package org.jmonkeyengine.screenshottests.gui; | ||
|
||
import com.jme3.anim.AnimComposer; | ||
import com.jme3.app.Application; | ||
import com.jme3.app.SimpleApplication; | ||
import com.jme3.app.state.BaseAppState; | ||
import com.jme3.asset.AssetManager; | ||
import com.jme3.export.binary.BinaryExporter; | ||
import com.jme3.export.binary.BinaryImporter; | ||
import com.jme3.font.BitmapFont; | ||
import com.jme3.font.BitmapText; | ||
import com.jme3.font.Rectangle; | ||
import com.jme3.light.DirectionalLight; | ||
import com.jme3.math.ColorRGBA; | ||
import com.jme3.math.Vector3f; | ||
import com.jme3.renderer.Camera; | ||
import com.jme3.renderer.queue.RenderQueue; | ||
import com.jme3.scene.Geometry; | ||
import com.jme3.scene.Node; | ||
import com.jme3.scene.Spatial; | ||
import com.jme3.scene.shape.Quad; | ||
import org.jmonkeyengine.screenshottests.testframework.ExtentReportExtension; | ||
import org.jmonkeyengine.screenshottests.testframework.ScreenshotTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
|
||
@ExtendWith(ExtentReportExtension.class) | ||
public class TestBitmapText3D{ | ||
|
||
|
||
/** | ||
* This tests both that bitmap text is rendered correctly and that it is | ||
* wrapped correctly. | ||
*/ | ||
@Test | ||
public void testBitmapText3D(){ | ||
|
||
new ScreenshotTest( | ||
new BaseAppState(){ | ||
@Override | ||
protected void initialize(Application app){ | ||
String txtB = "ABCDEFGHIKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()-=_+[]\\;',./{}|:<>?"; | ||
|
||
AssetManager assetManager = app.getAssetManager(); | ||
Node rootNode = ((SimpleApplication)app).getRootNode(); | ||
|
||
Quad q = new Quad(6, 3); | ||
Geometry g = new Geometry("quad", q); | ||
g.setLocalTranslation(-1.5f, -3, -0.0001f); | ||
g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); | ||
rootNode.attachChild(g); | ||
|
||
BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); | ||
BitmapText txt = new BitmapText(fnt); | ||
txt.setBox(new Rectangle(0, 0, 6, 3)); | ||
txt.setQueueBucket(RenderQueue.Bucket.Transparent); | ||
txt.setSize( 0.5f ); | ||
txt.setText(txtB); | ||
txt.setLocalTranslation(-1.5f,0,0); | ||
rootNode.attachChild(txt); | ||
} | ||
|
||
@Override | ||
protected void cleanup(Application app){} | ||
|
||
@Override | ||
protected void onEnable(){} | ||
|
||
@Override | ||
protected void onDisable(){} | ||
} | ||
).run(); | ||
|
||
|
||
} | ||
} |