Add imagedialog test case

And move the redundant stuff into tests/CMakeLists.txt
ImageDialog: Correctly close the save dialog on cancel