Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
cee1ce00
Commit
cee1ce00
authored
Sep 29, 2017
by
Fabien Tessier
Browse files
Options
Downloads
Patches
Plain Diff
Add unit test
parent
58280c32
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/ui/TDiagramPanel.java
+4
-0
4 additions, 0 deletions
src/main/java/ui/TDiagramPanel.java
tests/util/fr.tpt.ttool.tests.util/src/fr/tpt/ttool/tests/util/MoveComponentTest.java
+65
-0
65 additions, 0 deletions
...s.util/src/fr/tpt/ttool/tests/util/MoveComponentTest.java
with
69 additions
and
0 deletions
src/main/java/ui/TDiagramPanel.java
+
4
−
0
View file @
cee1ce00
...
...
@@ -3443,4 +3443,8 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
repaint
();
}
}
public
void
setComponentPointed
(
TGComponent
tgc
)
{
componentPointed
=
tgc
;
}
}
This diff is collapsed.
Click to expand it.
tests/util/fr.tpt.ttool.tests.util/src/fr/tpt/ttool/tests/util/MoveComponentTest.java
0 → 100644
+
65
−
0
View file @
cee1ce00
package
fr.tpt.ttool.tests.util
;
import
junit.framework.TestCase
;
import
myutil.PluginManager
;
import
ui.MainGUI
;
import
ui.tmldd.TMLArchiBUSNode
;
import
ui.tmldd.TMLArchiDiagramPanel
;
import
ui.tmldd.TMLArchiDiagramToolBar
;
import
org.junit.*
;
public
class
MoveComponentTest
extends
TestCase
{
static
MainGUI
mgui
;
static
TMLArchiDiagramToolBar
tb
;
static
TMLArchiDiagramPanel
tdp
;
static
TMLArchiBUSNode
tgc
;
@Before
public
void
setUp
()
throws
Exception
{
mgui
=
new
MainGUI
(
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
true
);
mgui
.
build
();
PluginManager
.
pluginManager
=
new
PluginManager
();
tb
=
new
TMLArchiDiagramToolBar
(
mgui
);
tdp
=
new
TMLArchiDiagramPanel
(
mgui
,
tb
);
tgc
=
new
TMLArchiBUSNode
(
500
,
500
,
0
,
1400
,
0
,
1900
,
true
,
null
,
tdp
);
tdp
.
setComponentPointed
(
null
);
}
@Test
public
void
testMoveUp
()
{
tdp
.
upComponent
();
tdp
.
setComponentPointed
(
tgc
);
tdp
.
upComponent
();
assert
tgc
.
getY
()
==
499
;
assert
tgc
.
getX
()
==
500
;
}
@Test
public
void
testMoveDown
()
{
tdp
.
downComponent
();
tdp
.
setComponentPointed
(
tgc
);
tdp
.
downComponent
();
assert
tgc
.
getY
()
==
501
;
assert
tgc
.
getX
()
==
500
;
}
@Test
public
void
testMoveRight
()
{
tdp
.
rightComponent
();
tdp
.
setComponentPointed
(
tgc
);
tdp
.
rightComponent
();
assert
tgc
.
getX
()
==
501
;
assert
tgc
.
getY
()
==
500
;
}
@Test
public
void
testMoveLeft
()
{
tdp
.
leftComponent
();
tdp
.
setComponentPointed
(
tgc
);
tdp
.
leftComponent
();
assert
tgc
.
getX
()
==
499
;
assert
tgc
.
getY
()
==
500
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment