| 140 | } |
| 141 | |
| 142 | void |
| 143 | BaseTest::connectNodes(NodePtr input, |
| 144 | NodePtr output, |
| 145 | int inputNumber, |
| 146 | bool expectedReturnValue) |
| 147 | { |
| 148 | if (expectedReturnValue) { |
| 149 | ///check that the connections are internally all set as "expected" |
| 150 | |
| 151 | EXPECT_EQ( (Node*)NULL, output->getInput(inputNumber).get() ); |
| 152 | EXPECT_FALSE( output->isInputConnected(inputNumber) ); |
| 153 | } else { |
| 154 | ///the call can only fail for those 2 reasons |
| 155 | EXPECT_TRUE(inputNumber > output->getNInputs() || //< inputNumber is greater than the maximum input number |
| 156 | output->getInput(inputNumber).get() != (Node*)NULL); //< input slot is already filled with another node |
| 157 | } |
| 158 | |
| 159 | |
| 160 | bool ret = getApp()->getProject()->connectNodes(inputNumber, input, output); |
| 161 | EXPECT_EQ(expectedReturnValue, ret); |
| 162 | |
| 163 | if (expectedReturnValue) { |
| 164 | EXPECT_TRUE( input->hasOutputConnected() ); |
| 165 | EXPECT_EQ(output->getInput(inputNumber), input); |
| 166 | EXPECT_TRUE( output->isInputConnected(inputNumber) ); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | void |
| 171 | BaseTest::disconnectNodes(NodePtr input, |
no test coverage detected