Testing magnetofrictional extrapolation with the Titov-Démoulin model of solar active regions