Skip to content

Commit 09c9f3f

Browse files
author
Davide Faconti
committed
unit test added, related to error #24
1 parent 88cbc05 commit 09c9f3f

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

test/editor_test.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ private slots:
2323
void multipleSubtrees();
2424
void editText();
2525
void loadModelLess();
26+
void longNames();
2627
void clearModels();
2728
void undoWithSubtreeExpanded();
2829
};
@@ -480,13 +481,29 @@ void EditorTest::loadModelLess()
480481

481482
const auto& moverobot_model = models.at("moverobot");
482483

483-
// TODO VER_3
484484
// QCOMPARE( moverobot_model.params.size(), size_t(1) );
485485
// QCOMPARE( moverobot_model.params.front().label, tr("location") );
486486
// QCOMPARE( moverobot_model.params.front().value, tr("1") );
487487

488488
}
489489

490+
void EditorTest::longNames()
491+
{
492+
QString file_xml = readFile(":/issue_24.xml");
493+
main_win->on_actionClear_triggered();
494+
main_win->loadFromXML( file_xml );
495+
496+
auto abs_tree = getAbstractTree();
497+
QCOMPARE( abs_tree.nodesCount(), size_t(4) );
498+
auto sequence = abs_tree.node(1);
499+
QCOMPARE( sequence->model.registration_ID, QString("Sequence"));
500+
501+
// second child on the right side.
502+
int short_index = sequence->children_index[1];
503+
auto short_node = abs_tree.node(short_index);
504+
QCOMPARE( short_node->model.registration_ID, QString("short") );
505+
}
506+
490507
void EditorTest::clearModels()
491508
{
492509
QString file_xml = readFile(":/crossdoor_with_subtree.xml");

test_data/issue_24.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<root >
2+
<BehaviorTree>
3+
<Sequence>
4+
<Action ID="very_very_long_name_incredibly_long"/>
5+
<Action ID="short"/>
6+
</Sequence>
7+
</BehaviorTree>
8+
</root>

test_data/test_files.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
<file>simple_without_model.xml</file>
1010
<file>subtree_test_fail.xml</file>
1111
<file>issue_3.xml</file>
12+
<file>issue_24.xml</file>
1213
</qresource>
1314
</RCC>

0 commit comments

Comments
 (0)