Testicular pain can be due to injury, infection (Epididymitis or Orchitis) or inflammation, testicular torsion( most common in young men), excessive bicycle riding, hernia,varicocele or kidney or ureteric stones.
As there is a purple discoloration of the penis, so the chances of epidiymitis or orchitis or vascular insufficiency are there.
Lab investigations like complete blood examination, urine examination, ultrasound lower abdomen, vascular color Doppler and sometimes a urethral swab will help in diagnosis. Treatment will be started thereafter. My advice would be to consult a urologist.
I hope it helps.Take care and regards.