I believe a negative sign is missing in the highlighted part. That is, $Pr(test(\tilde D) \leq \textbf{-test(D)}|\tilde D \sim H_0)$. Otherwise, the sum of $Pr(test(\tilde D) \geq test(D)|\tilde D \sim H_0) + Pr(test(\tilde D) \leq test(D) | \tilde D \sim H_0) = 1$. Also this assumes test(D) is positive.
I believe a negative sign is missing in the highlighted part. That is, $Pr(test(\tilde D) \leq \textbf{-test(D)}|\tilde D \sim H_0)$. Otherwise, the sum of $Pr(test(\tilde D) \geq test(D)|\tilde D \sim H_0) + Pr(test(\tilde D) \leq test(D) | \tilde D \sim H_0) = 1$. Also this assumes test(D) is positive.