Oscar Pistorius fired a gun through the roof of a car in a fit of petulance after an argument with a police officer, his ex-girlfriend told a court on Friday.

As the Paralympic sprinter stared coldly at her from the dock, Samantha Taylor testified that he carried a gun with him "all the time" when they were dating.

It was the latest piece of evidence to call Pistorius's character into question at the end of a dramatic first week in a murder trial that could only be more tense if South Africa still imposed the death penalty.

Millions of TV viewers watched the prosecution and defence trade blows over what happened on the night one of the world's most famous sportsmen shot dead his girlfriend, Reeva Steenkamp, a law graduate, model and reality TV star.

The public also had unprecedented access to the grilling of star witnesses and the emotional reactions of Pistorius sitting in the dock, debating every twist and turn of proceedings in real time on Twitter. Some critics have found the televised trial salacious and obtrusive.

After week one, there are strong opinions on both sides but few would dare to predict the judge's verdict on Pistorius, a double amputee known as the "blade runner" because of his prosthetic limbs.

Along with the murder charge, Pistorius is being tried for three firearms offences, presumably so the prosecution can build a picture of him as hot-headed and reckless with guns.

On one of these counts, Taylor, who was nervous and tearful on the witness stand, claimed that an angry Pistorius had fired his pistol out of a car's open sun-roof after a heated argument with a police officer in September 2012. Taylor said she, Pistorius and a friend, Darren Fresco, had been pulled over by a policeman for speeding. When he saw Pistorius's pistol lying on the car seat, the officer picked it up and emptied its magazine on to the floor of the car, prompting an outburst from Pistorius, she said.

When they were allowed to go on their way, Pistorius and Fresco started to joke about shooting out a "robot" – a South African term for a traffic light. "Oscar was very angry," said Taylor, who was sitting in the back seat at the time. "Thereafter they were joking around and saying they wanted to shoot a robot. Two minutes after, I saw Oscar take his gun and shoot out of the car roof. A very loud sound. They both laughed."

Taylor's testimony comes two days after the court heard that Pistorius accidentally fired a pistol under the table in a packed Johannesburg restaurant – close to a child – and then asked Fresco to take the blame.

Taylor described two other incidents in which Pistorius drew his gun. The first was when he jumped out of his car at the gateway of his Pretoria housing complex and put his gun to the window of a black BMW that appeared to have been following him. The second was when he woke up in the middle of the night after hearing a bang in the bathroom.

"There was one occasion when something hit the bathroom window and Oscar woke me up and asked me if I heard it," Taylor said, noting that the noise had probably been generated by a passing storm. "He got up with his gun and walked out of the room."

Taylor said she was 17 when she started dating Pistorius and spent four nights a week at his home. Asked why they broke up on 4 November 2012, Taylor told the court: "He cheated on me with Reeva Steenkamp."

According to the defence lawyer Barry Roux, Taylor had sent an email to Pistorius apologising for cheating on him. She explained that there had been an "altercation" over a trip she took to Dubai with a man in 2012 when Pistorius was taking part in the London Paralympics, but she was not Pistorius's girlfriend at that time.

the court revisited the events of 14 February 2013, when Steenkamp died. Pieter Baba, who was on guard duty at the gated community where Pistorius lived, said he called the athlete after hearing gunshots in the early hours. He said Pistorius told him: "Security, everything is fine."

Through an Afrikaans interpreter, Baba added: "That's when I realised that Mr Pistorius was crying. That's when I said to Jacob [a colleague], not everything is in order as Mr Pistorius was telling me."

A few minutes later Pistorius called him back, Baba said. "Maybe he wasn't sure about calling me back. He just started crying over the phone. That's when the line went off."

Roux pressed Baba on whether he could recall if Pistorius had said he was fine or everything was fine. Baba insisted: "Mr Pistorius's exact words were: 'Security, everything is fine'."

Steenkamp died after being hit by three of four rounds fired by Pistorius from a 9mm pistol through the door of a toilet cubicle in an upstairs bathroom in his luxury home in a Pretoria gated community. The shooting stunned South Africa and millions of Pistorius fans around the world.

The 27-year-old denies murder, saying it was a tragic accident and that he mistook her for an intruder. If found guilty, he is likely to spend at least 25 years behind bars. "A man's life is at stake," Roux told one witness this week, urging him to consider every possible explanation for what he had heard.

Based on the evidence of the first week, it appears there were two sets of noises heard by neighbours. The defence claims that the first noises were the four gunshots fired that night, while the second noises were the sound of a desperate Pistorius smashing down the bathroom door in an attempt to save Steenkamp. The prosecution holds that the second noises were in fact the shots, and is yet to explain what the first set was.

Neighbours have testified to hearing "bloodcurdling screams" that suggested a woman knew she was in mortal danger. The defence is making the unexpected claim that Pistorius screams like a woman when he is anxious and therefore neighbours confused his cries for help with those of a female victim. It remains to be seen how this assertion will be put to the test.

Roux has quizzed witnesses in minute detail about their testimonies, patiently probing for any contradictions and homing in on any minor discrepancy, sometimes with sarcasm that some observers have found patronising.

The prosecutor Gerrie Nel is yet to reveal his full hand in seeking to prove that this is a case of premeditated murder following an argument. He has previously made a case that, irrespective of who he believed was behind the toilet door, Pistorius shot with the intent to kill and is therefore bound to be convicted of murder.

The trial has also given South Africans an insight into the workings of the criminal justice system; more than 70% told a TV poll that they had found it educational. Some have been surprised by the tough grilling given to witnesses. There has also been the spectacle of an accused man sobbing and at one point retching on live television.

The witnesses so far have included a university lecturer, a radiologist and a professional boxer, all but one of whom have been white. Together they have offered a glimpse of a slice of South African society, including its heavily guarded gated communities where it seems everyone goes to bed by 10pm.

Not everything has gone smoothly: one broadcaster was reprimanded for showing a photo of a witness who did not wish to be identified, while Roux said sorry for reading out the phone number of a witness who subsequently received numerous calls and messages. There have also been awkward moments as the Pistorius and Steenkamp families, sitting directly in front of the media, can at times hear journalists' indiscreet banter.

The case continues with the main piece of theatre yet to come: Pistorius taking the witness stand under the world's gaze.