Brandon Muir died in Ninewells Hospital in Dundee
A man angrily attacked a toddler just two months before the boy died, the High Court in Glasgow has been told.
Robert Cunningham, 23, denies murdering 23-month-old Brandon Muir by assaulting him at flats in Dundee in March.
The court heard that about January of last year Mr Cunningham had got so mad with the boy that veins were "popping out of his neck" when he hit him.
Brandon's mother Heather Boyd, also 23, denies the culpable homicide of her son by failing to get him medical help.
Lesley Craig, who knew the couple, told the court that she saw Mr Cunningham hit Brandon about January of last year.
She sobbed: "Brandon was being his usual boisterous self. He was just running about and Robert asked him to stop.
"Robert told him more than once. He was not happy, quite angry and loud.
"Brandon went on running about and he smacked him across the head and threw him on the ground."
The witness said the force used was "not the way you would hit a child".
When she confronted him, Miss Craig was told: "What's it got to do with you?"
Miss Craig added: "His face was really, really red when he smacked him. His veins were popping out of his face and neck."
Miss Craig also told the court that she saw Mr Cunningham assault another boy, aged around one.
The child had chewed off his fingernail and Mr Cunningham allegedly smacked him.
Miss Craig said: "I think he grabbed him by the arm and picked him up.
"He just smacked him and threw him on the ground and made him sit down. It was a hard smack."
She later added that is was "more like an assault you would expect between two adults."
Miss Craig also told the court that she had never seen Ms Boyd hit Brandon.
Mr Cunningham is accused of murder by assaulting Brandon so severely on 15 March at two flats in Balunie Crescent that he died the following day in hospital.
Mr Cunningham and Ms Boyd also face a charge of repeatedly and wilfully ill-treating Brandon between October 2007 and March 2008.
Ms Boyd is accused of assaulting her son at Douglas Family Centre in Dundee on 5 March last year.
Mr Cunningham is also charged with repeatedly and wilfully ill-treating another young boy at properties in Dundee between October 2007 and March 2008.
The pair deny all the charges.
The trial, before judge John Morris QC, continues.