~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to kmail/tests/messagedicttests.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * Copyright (C)  2005 Till Adam <adam@kde.org>
3
 
 * This file is subject to the GPL version 2.
4
 
 */
5
 
 
6
 
#include "messagedicttests.h"
7
 
 
8
 
#include "kmdict.h"
9
 
 
10
 
#include <kdebug.h>
11
 
#include "qtest_kde.h"
12
 
 
13
 
QTEST_KDEMAIN_CORE( MessageDictTester )
14
 
 
15
 
void MessageDictTester::initTestCase()
16
 
{
17
 
    m_dict = new KMDict( 4 ); // will be thrown away in init
18
 
}
19
 
 
20
 
void MessageDictTester::cleanupTestCase()
21
 
{
22
 
    delete m_dict;
23
 
}
24
 
 
25
 
void MessageDictTester::test_KMDictCreation()
26
 
{
27
 
    QCOMPARE( m_dict->size(), 31 );
28
 
    m_dict->init( 13 ); // will be created with a 13, no nextPrime()
29
 
    QCOMPARE( m_dict->size(), 13 );
30
 
}
31
 
 
32
 
void MessageDictTester::test_KMDictInsert()
33
 
{
34
 
    KMDictItem *item = new KMDictItem();
35
 
    m_dict->insert( 12345, item );
36
 
    KMDictItem *found = m_dict->find( 12345 );
37
 
    QCOMPARE( item, found);
38
 
}
39
 
 
40
 
void MessageDictTester::test_KMDictRemove()
41
 
{
42
 
  m_dict->remove( 12345 );
43
 
  KMDictItem *item = m_dict->find( 12345 );
44
 
  QCOMPARE( item, (KMDictItem*)0 );
45
 
}
46
 
 
47
 
void MessageDictTester::test_KMDictClear()
48
 
{
49
 
  for ( unsigned int i=0; i<11; ++i )
50
 
    m_dict->insert( i, new KMDictItem() );
51
 
  m_dict->clear();
52
 
  QCOMPARE( m_dict->mVecs, (KMDictItem**)0 );
53
 
}
54
 
 
55
 
void MessageDictTester::test_KMDictReplace()
56
 
{
57
 
  m_dict->init( 31 );
58
 
  KMDictItem *oldItem = new KMDictItem();
59
 
  KMDictItem *newItem = new KMDictItem();
60
 
  m_dict->insert( 12345, oldItem );
61
 
  m_dict->replace( 12345, newItem );
62
 
  KMDictItem *found = m_dict->find( 12345 );
63
 
  QCOMPARE( found, newItem );
64
 
}
65
 
 
66
 
#include "messagedicttests.moc"
67