Add link layout tests, Refine test code