BUDAPEST—Six leading candidates vying to stand against Hungarian Prime Minister Viktor Orban jointly announced on Tuesday that if elected they would repudiate two giant Chinese projects—a university campus in the capital and a railway to Belgrade. Hungary’s long-divided opposition is planning to field a single candidate for prime minister to run against nationalist Orban in an election due by next year, expected to be the toughest challenge of his 11 years in power. Orban, a self-described “illiberal,” has angered Western allies by steering his country towards closer ties with Russia and China. In two of his highest-profile projects with Beijing, Orban aims to open a campus of Shanghai’s Fudan University in Budapest and have Chinese companies build a new railway link between the Hungarian and Serbian capitals. In a letter addressed to Chinese President Xi Jinping, the six candidates said they had agreed that whichever of them becomes prime minister …