~ubuntu-branches/ubuntu/oneiric/compiz/oneiric-proposed

« back to all changes in this revision

Viewing changes to tests/pluginclasshandler/test-pluginclasshandler.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-07-19 08:00:29 UTC
  • mfrom: (0.168.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20110719080029-zn4l32f34modz570
Tags: 1:0.9.5.0-0ubuntu1
* New upstream release:
  - unity window decorator needs to support different metacity frame types
    (LP: #795048)
  - firefox window mapped fullscreen gets mapped under gnome-panel
    (LP: #800592)
* Switch to dpkg-source 3.0 (quilt) format
* remove all debian/patches/*:
  - upstream now directly deliver with our patches
* debian/control:
  - replace kdebase-workspace-dev build-dep by kde-workspace-dev
  - build on libdecoration0-dev to build the unity window decorator
  - make compiz-dev dep on gtk-3
* debian/compiz-plugins-default.install:
  - grid is now in -main
* debian/libdecoration0.symbols:
  - add new symbols
* debian/patches/01_don_t_init_a11y.patch:
  - don't initialize the GAIL and AT bridges when comipz initialize
    (LP: #810045)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "test-pluginclasshandler.h"
 
2
 
 
3
PluginClassStorage::Indices globalPluginClassIndices (0);
 
4
unsigned int                pluginClassHandlerIndex = 0;
 
5
bool                        debugOutput;
 
6
char                        *programName;
 
7
 
 
8
namespace
 
9
{
 
10
    static CompizPCHTest *gTest;
 
11
};
 
12
 
 
13
Global::Global ()
 
14
{
 
15
}
 
16
 
 
17
unsigned int
 
18
Base::allocPluginClassIndex ()
 
19
{
 
20
    unsigned int i = PluginClassStorage::allocatePluginClassIndex (globalPluginClassIndices);
 
21
 
 
22
    foreach (Base *b, gTest->global->bases)
 
23
    {
 
24
        if (globalPluginClassIndices.size () != b->pluginClasses.size ())
 
25
            b->pluginClasses.resize (globalPluginClassIndices.size ());
 
26
    }
 
27
 
 
28
    return i;
 
29
}
 
30
 
 
31
void
 
32
Base::freePluginClassIndex (unsigned int index)
 
33
{
 
34
    PluginClassStorage::freePluginClassIndex (globalPluginClassIndices, index);
 
35
 
 
36
    foreach (Base *b, gTest->global->bases)
 
37
    {
 
38
        if (globalPluginClassIndices.size () != b->pluginClasses.size ())
 
39
            b->pluginClasses.resize (globalPluginClassIndices.size ());
 
40
    }
 
41
}
 
42
 
 
43
Base::Base () :
 
44
    PluginClassStorage (globalPluginClassIndices)
 
45
{
 
46
    gTest->global->bases.push_back (this);
 
47
}
 
48
 
 
49
Base::~Base ()
 
50
{
 
51
    gTest->global->bases.remove (this);
 
52
}
 
53
 
 
54
Plugin::Plugin (Base *base) :
 
55
    b (base)
 
56
{
 
57
}
 
58
 
 
59
Plugin::~Plugin ()
 
60
{
 
61
}
 
62
 
 
63
CompizPCHTest::CompizPCHTest (Global *g) :
 
64
    global (g)
 
65
{
 
66
    ValueHolder::SetDefault (static_cast<ValueHolder *> (global));
 
67
}
 
68
 
 
69
CompizPCHTest::~CompizPCHTest ()
 
70
{
 
71
    delete global;
 
72
}
 
73
 
 
74
int
 
75
main (int argc, char **argv)
 
76
{
 
77
    programName = argv[0];
 
78
 
 
79
    gTest = static_cast <CompizPCHTest *> (new OBJECT (new Global ()));
 
80
    gTest->run ();
 
81
 
 
82
    while (gTest->plugins.size ())
 
83
    {
 
84
        Plugin *p = gTest->plugins.front ();
 
85
        gTest->plugins.pop_front ();
 
86
 
 
87
        delete p;
 
88
    }
 
89
 
 
90
    while (gTest->bases.size ())
 
91
    {
 
92
        Base *b = gTest->bases.front ();
 
93
        gTest->bases.pop_front ();
 
94
 
 
95
        delete b;
 
96
    }
 
97
 
 
98
    delete gTest;
 
99
    
 
100
    return 0;
 
101
}