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
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,17 @@ if(BUILD_CAPI)
dasher_add_test(dasher_deterministic_tests test_deterministic.cpp)
dasher_add_test(dasher_training_tests test_training.cpp)
dasher_add_test(dasher_node_tree_tests test_node_tree.cpp)

# Control action system tests — needs internal DasherCore classes (ActionRegistry)
# AND C API functions, so we compile CAPI.cpp directly and link DasherCore
add_executable(dasher_control_action_tests
${CMAKE_CURRENT_LIST_DIR}/tests/test_control_actions.cpp
${CMAKE_CURRENT_LIST_DIR}/src/CAPI.cpp)
target_include_directories(dasher_control_action_tests PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/
${CMAKE_CURRENT_LIST_DIR}/tests/)
target_link_libraries(dasher_control_action_tests PRIVATE DasherCore pugixml)
target_compile_definitions(dasher_control_action_tests PRIVATE TEST_DATA_DIR="${TEST_DATA_DIR}")
add_test(NAME dasher_control_action_tests COMMAND dasher_control_action_tests)
endif()
endif()
37 changes: 37 additions & 0 deletions Data/control/control.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!ELEMENT control ((node|alph)*)>
<!ATTLIST control name CDATA #REQUIRED>

<!ELEMENT node ((node|move|delete|copy|speak|pause|stop|ref|root|alph)*)>
<!--by specifying the name attribute as type ID rather than CDATA, the XML
validator checks that all IDs are distinct:-->
<!ATTLIST node name ID #IMPLIED>
<!ATTLIST node label CDATA #REQUIRED>
<!ATTLIST node color CDATA #IMPLIED>

<!ELEMENT move EMPTY>
<!ATTLIST move forward (yes|no) #REQUIRED>
<!ATTLIST move dist (char|word|line|sentence|paragraph|page|all) #REQUIRED>

<!ELEMENT delete EMPTY>
<!ATTLIST delete forward (yes|no) #REQUIRED>
<!ATTLIST delete dist (char|word|line|sentence|paragraph|page|all) #REQUIRED>

<!ELEMENT copy EMPTY>
<!ATTLIST copy what (new|repeat|word|line|sentence|paragraph|page|all) #REQUIRED>

<!ELEMENT speak EMPTY>
<!ATTLIST speak what (cancel|new|repeat|word|line|sentence|paragraph|page|all) #REQUIRED>

<!ELEMENT pause EMPTY>

<!ELEMENT stop EMPTY>

<!ELEMENT ref EMPTY>
<!--by specifying the name attribute as type IDREF rather than CDATA, the XML
validator checks that a node with that name (as an ID) exists-->
<!ATTLIST ref name IDREF #REQUIRED>

<!ELEMENT root EMPTY>

<!ELEMENT alph EMPTY>
218 changes: 218 additions & 0 deletions Data/control/control.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE control SYSTEM "control.dtd">
<control name="">
<alph/>

<node label="Stop" color="242">
<stop/>
<alph/>
<root/>
</node>

<node label="Pause" color="241">
<pause/>
<alph/>
<root/>
</node>

<node name="CTL_MOVE" label="Move" color="-1">
<alph/>
<node name="CTL_MOVE_BACKWARD" label="&lt;=" color="-1">
<node label="All" color="-1">
<move forward="no" dist="all"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Para." color="-1">
<move forward="no" dist="paragraph"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Sent." color="-1">
<move forward="no" dist="sentence"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Word" color="-1">
<move forward="no" dist="word"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Char" color="-1">
<move forward="no" dist="char"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
</node>

<node name="CTL_MOVE_FORWARD" label="=&gt;" color="-1">

<node label="Char" color="-1">
<move forward="yes" dist="char"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Word" color="-1">
<move forward="yes" dist="word"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Sent." color="-1">
<move forward="yes" dist="sentence"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="Para." color="-1">
<move forward="yes" dist="paragraph"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
<node label="All" color="-1">
<move forward="yes" dist="all"/>
<alph/>
<ref name="CTL_MOVE_BACKWARD"/>
<ref name="CTL_MOVE_FORWARD"/>
</node>
</node>


</node>
<node name="CTL_DELETE" label="Delete" color="-1">
<alph/>
<node name="CTL_DELETE_BACKWARD" label="&lt;x" color="-1">
<node label="All" color="-1">
<delete forward="no" dist="all"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Para." color="-1">
<delete forward="no" dist="paragraph"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Sent." color="-1">
<delete forward="no" dist="sentence"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Word" color="-1">
<delete forward="no" dist="word"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Char" color="-1">
<delete forward="no" dist="char"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
</node>

<node name="CTL_DELETE_FORWARD" label="x&gt;" color="-1">

<node label="Char" color="-1">
<delete forward="yes" dist="char"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Word" color="-1">
<delete forward="yes" dist="word"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Sent." color="-1">
<delete forward="yes" dist="sentence"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="Para." color="-1">
<delete forward="yes" dist="paragraph"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
<node label="All" color="-1">
<delete forward="yes" dist="all"/>
<alph/>
<ref name="CTL_DELETE_BACKWARD"/>
<ref name="CTL_DELETE_FORWARD"/>
</node>
</node>


</node>
<node name="CTL_CLEAR" label="Clear" color="-1">
<alph/>
<node label="All" color="242">
<delete forward="yes" dist="all"/>
<delete forward="no" dist="all"/>
<alph/>
<root/>
</node>
<alph/>
</node>

<node name="CTL_SPEAK" label="Speak" color="241">

<node label="Stop" color="242">
<speak what="cancel"/>
<alph/>
<root/>
</node>
<node label="Repeat" color="241">
<speak what="repeat"/>
<alph/>
<root/>
</node>
<node label="Para." color="-1">
<speak what="paragraph"/>
<move forward="yes" dist="paragraph"/>
<alph/>
<node label="ClearPara." color="242">
<delete forward="no" dist="paragraph"/>
<delete forward="no" dist="char"/>
<alph/>
<root/>
</node>
<node name="CTL_SPEAK_PARAGRAPH2" label="SpeakPara." color="-1">
<speak what="paragraph"/>
<move forward="yes" dist="paragraph"/>
<alph/>
<ref name="CTL_SPEAK_PARAGRAPH2"/>
<ref name="CTL_SPEAK"/>
</node>
<ref name="CTL_SPEAK"/>
</node>
<node label="All" color="-1">
<speak what="all"/>
<move forward="yes" dist="all"/>
<alph/>
<node label="ClearAll" color="242">
<delete forward="yes" dist="all"/>
<delete forward="no" dist="all"/>
<alph/>
<root/>
</node>
<ref name="CTL_SPEAK"/>
</node>
<alph/>
</node>

</control>

Loading
Loading