[Kdenlive-devel] Adding unittests to kdenlive?
Mads Bondo Dydensborg
mads at dydensborg.dk
Mon Dec 15 15:49:16 UTC 2008
mandag 15 December 2008 skrev jb:
> On Monday 15 December 2008 08.39:36 Mads Bondo Dydensborg wrote:
> > As kdenlive is clearly very much a GUI program major parts of kdenlive can
> > not be unittested. However, some parts can. Right now I would like to
> > create a unit test for part of the KdenliveDoc::convertDocument()
function.
> > I am capable of doing this, but would like to know beforehand if it would
> > be OK with all? (Especially JB, I reckon).
>
> I have absolutely no experience in unit tests, but I admit that it would be
> great to have an automated way to check the loading / saving of documents
> whenever some changes are made to the kdenlive document format.
I will add something then.
How about asserts?
A number of functions could benefit from asserts, I think. Look at
http://www.kdenlive.org/mantis/view.php?id=472
It crashes in:
void ClipItem::setEffectAt(int ix, QDomElement effect) {
kDebug() << "CHange EFFECT AT: " << ix << ", CURR: " <<
m_effectList.at(ix).attribute("tag") << ", NEW: " << effect.attribute("tag");
because m_effectList is empty.
Would you mind me adding
Q_ASSERT_X( m_effectList.size() > ix, "ClipItem::setEffectAt", QString( "Index
ix = %1 is out of bounds, m_effectList.size() = %2. Kdenlive expected that
more than ix effects were present" ). arg ( ix ). arg( m_effectList.size() );
or similar to that function? (I'll use the correct QString syntax, can't
recall right now). And other places, where I stumble on similar situations?
I know that QList will assert on debug builds, but it would be nice to get a
bit more information.
There are also a number of potential NULL references, that I would like to
assert.
Regards
Mads
--
Mads Bondo Dydensborg mads at dydensborg.dk http://www.madsdydensborg.dk/
Of course the people don't want war. But after all, it's the leaders of the
country who determine the policy, and it's always a simple matter to drag the
people along whether it's a democracy, a fascist dictatorship, or a
parliament, or a communist dictatorship. Voice or no voice, the people can
always be brought to the bidding of the leaders. That is easy. All you have
to do is tell them they are being attacked, and denounce the pacifists for
lack of patriotism, and exposing the country to greater danger.
- Herman Goering at the Nuremberg trials
More information about the Kdenlive
mailing list