Gridarta Editor
ToolTipAppenderTest.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.gui.map.renderer;
21 
28 import org.junit.Assert;
29 import org.junit.Test;
30 
35 public class ToolTipAppenderTest {
36 
40  @Test
41  public void testEmbeddedHtml1() {
42  final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false);
46  final TestArchetype archetype = gameObjectFactory.newArchetype("arch");
47  final TestGameObject gameObject = gameObjectFactory.createGameObject(archetype);
48  gameObject.setAttributeString("<key>", "<value>&<value>");
49  toolTipAppender.appendGameObject(gameObject, false, "");
50  final String tooltip = toolTipAppender.finish();
51  Assert.assertEquals("<html><b>arch</b><br>&lt;key&gt; &lt;value&gt;&amp;&lt;value&gt;", tooltip);
52  }
53 
54 }
net.sf.gridarta.model.archetype.TestArchetype
An Archetype implementation for testing purposes.
Definition: TestArchetype.java:30
net.sf.gridarta.model.gameobject.GameObjectFactory
Abstract factory for creating GameObject instances.
Definition: GameObjectFactory.java:31
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.model.gameobject.TestGameObject
A GameObject implementation for testing purposes.
Definition: TestGameObject.java:34
net.sf
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.model.mapmodel.TestMapModelCreator
Helper class for regression tests to create MapModel instances.
Definition: TestMapModelCreator.java:63
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.gui.map.renderer.ToolTipAppenderTest
Regression tests for ToolTipAppender.
Definition: ToolTipAppenderTest.java:35
net.sf.gridarta.gui.map.renderer.ToolTipAppenderTest.testEmbeddedHtml1
void testEmbeddedHtml1()
Checks that HTML tags are correctly encoded in tooltip.
Definition: ToolTipAppenderTest.java:41
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net
net.sf.gridarta.model.gameobject.GameObjectFactory.newArchetype
R newArchetype(@NotNull String archetypeName)
Creates a new Archetype instance.
net.sf.gridarta.model.mapmodel.TestMapModelCreator.getGameObjectFactory
GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > getGameObjectFactory()
Returns the GameObjectFactory instance.
Definition: TestMapModelCreator.java:294
net.sf.gridarta.model.gameobject.GameObjectFactory.createGameObject
G createGameObject(@NotNull R archetype)
Creates a new GameObject from an Archetype.
net.sf.gridarta.gui.map.renderer.ToolTipAppender.finish
String finish()
Definition: ToolTipAppender.java:94
net.sf.gridarta.model.io
Reading and writing of maps, handling of paths.
Definition: AbstractAnimationObjectsReader.java:20
net.sf.gridarta.gui.map.renderer.ToolTipAppender
Definition: ToolTipAppender.java:38
net.sf.gridarta.model
net.sf.gridarta.gui.map.renderer.ToolTipAppender.appendGameObject
void appendGameObject(@NotNull final G gameObject, final boolean alwaysInclude, @NotNull final String prefix)
Definition: ToolTipAppender.java:61
net.sf.gridarta.model.maparchobject.TestMapArchObject
A MapArchObject implementation for testing purposes.
Definition: TestMapArchObject.java:28
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.model.io.GameObjectParser
Interface for classes that read or write GameObject instances.
Definition: GameObjectParser.java:37
net.sf.gridarta.model.mapmodel.TestMapModelCreator.newGameObjectParser
GameObjectParser< TestGameObject, TestMapArchObject, TestArchetype > newGameObjectParser()
Creates a new GameObjectParser instance.
Definition: TestMapModelCreator.java:357