MB3 65a: Visiting an Avel or a Sick Person on Shabbos (287:1); Fasting on Shabbos (288:1-2)

Chazal only permitted visiting a sick person or an avel on Shabbos if there's no other alternative since it causes tza'ar and crying.

The prohibition against fasting on Shabbos. What if someone gets pleasure from fasting?