|
|
|
@@ -1023,6 +1023,39 @@ void testLogicContinuousInsertionConsumesFullWire() |
|
|
|
"the toolbar must reject only the eleventh condition after all wires are consumed"); |
|
|
|
} |
|
|
|
|
|
|
|
void testLogicHorizontalWireCanBeInsertedAgainAfterUndoingFirstAutoRung() |
|
|
|
{ |
|
|
|
TestProjectStorage storage; |
|
|
|
ProjectService project_service(storage); |
|
|
|
LogicEditorService service(project_service); |
|
|
|
const std::string logic_id = service.ensureDefaultLogic().id; |
|
|
|
LogicEditorWidget editor(service); |
|
|
|
editor.setLogicId(logic_id); |
|
|
|
editor.resize(1400, 360); |
|
|
|
editor.show(); |
|
|
|
QApplication::processEvents(); |
|
|
|
|
|
|
|
require(editor.addHorizontalWire().succeeded, |
|
|
|
"the first horizontal wire must create the initial ladder network"); |
|
|
|
const ControlLogic *logic = service.findLogic(logic_id); |
|
|
|
require(logic != nullptr && logic->rungs.size() == 1U, |
|
|
|
"the first horizontal wire must leave one network in the model"); |
|
|
|
|
|
|
|
require(service.undo().succeeded, |
|
|
|
"undo must remove the automatically created network"); |
|
|
|
editor.reloadLogic(); |
|
|
|
logic = service.findLogic(logic_id); |
|
|
|
require(logic != nullptr && logic->rungs.empty(), |
|
|
|
"undo must restore the initially empty ladder logic"); |
|
|
|
|
|
|
|
require(editor.addHorizontalWire().succeeded, |
|
|
|
"a horizontal wire must be insertable again after undoing the first one"); |
|
|
|
logic = service.findLogic(logic_id); |
|
|
|
require(logic != nullptr && logic->rungs.size() == 1U |
|
|
|
&& logic->rungs.front().condition.has_value(), |
|
|
|
"reinserting the horizontal wire must create a fresh network"); |
|
|
|
} |
|
|
|
|
|
|
|
void testWindowTitleTracksUnsavedProjectChanges() |
|
|
|
{ |
|
|
|
TestProjectStorage storage; |
|
|
|
@@ -2446,6 +2479,7 @@ int main(int argc, char *argv[]) |
|
|
|
testLogicParallelPaddingGridInsertion(); |
|
|
|
testLogicParallelBranchConnectsShortBranchToRightJoin(); |
|
|
|
testLogicContinuousInsertionConsumesFullWire(); |
|
|
|
testLogicHorizontalWireCanBeInsertedAgainAfterUndoingFirstAutoRung(); |
|
|
|
testWindowTitleTracksUnsavedProjectChanges(); |
|
|
|
testModeActionsControlEditingAvailability(); |
|
|
|
testRuntimeMonitorWindowLifecycle(); |
|
|
|
|