Here's an idea.

1. Your test line is parallel to the parallel lines of the trapezoid. Hence, there's no need to test for intersection with the parallel lines.

2. Parametrize the non-parallel lines of the trapezoid as follows:

and

Parametrize your test line in the same way:

3. Attempt to solve, one after the other, the equations and for In both cases, there should be exactly one solution, since the lines are obviously not parallel. Test the value of and see if it is inside both allowable ranges. For example, if you're solving then make sure both that and If so, then you have an intersection. Otherwise, you don't.

Make sense?