PHB Chapter 8:
A long rest is a period of extended downtime, at least 8 hours long, during which a character sleeps for at least 6 hours and performs no more than 2 hours of light activity, such as reading, talking, eating, or standing watch. If the rest is interrupted by a period of strenuous activity - at least 1 hour of walking, fighting, casting spells, or similar adventuring activity - the characters must begin the rest again to gain any benefit from it.
So unless your race/class says differently, it's not 8 hours
sleep, but 8 hours
rest that is required, and you can even fight for over 500 rounds during it and not lose benefits. (Although the rest would have to be extended to complete the total 8-hour requirement)
So it's no different for spell casters than others. Sleep isn't tied to regaining spells, but rather to actually benefit from a long rest, and no long rest equals no spells.
Tidelan, similarily, regains his wild shape uses at the end of a long rest, even if he used it during the rest