On a 4 stroke engine it works as follows:
piston goes down with intake valves open/opening - Intake stroke - 1st stroke (1/2 revolution)
piston comes up with intake valves closed/closing and exhaust valves closed - compression stroke- 2nd stroke (1 revolution)
just before TDC, spark plug fires and compressed charge burns. The piston is at TDC - ON THE COMPRESSION STROKE - right here. Both exhaust and intake valves are closed.
piston gets pushed down by burning fuel air - power stroke - 3rd stroke (1 1/2 revolutions)
piston comes up as exhaust valves open - exhaust stroke - 4th stroke (2 revolutions)
One thing to note is valves are opening and closing as the piston is moving, and there is overlap with intake and exhaust valves open. it's not all instantaneous.
Also, another thing to note is that the piston passe TDC twice, only once being TDC on the power stroke. That's the point when you can pressurize the cylinder since both valves are closed. When one cylinder is at TDC on the compression stroke, another can be at TDC but with valves open.
So, to do a leak down, you need to identify TDC on the compression stroke of the cylinder you are interested in. having a helper see the pencil move up and down is helpful if you can't see it..