add decoration recreation test
svn path=/trunk/kdebase/kwin/; revision=396795
This commit is contained in:
parent
cc148f1762
commit
0bcfea20c9
4 changed files with 38 additions and 11 deletions
|
@ -40,7 +40,7 @@
|
|||
static KCmdLineOptions options[] =
|
||||
{
|
||||
{ "+decoration", "Decoration library to use, such as kwin3_plastik.", 0 },
|
||||
{ "+tests", "Which test should be executed ('all', 'repaint', 'caption', 'resize')", 0 },
|
||||
{ "+tests", "Which test should be executed ('all', 'repaint', 'caption', 'resize', 'recreation')", 0 },
|
||||
{ "+repetitions", "Number of test repetitions.", 0 },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
@ -53,10 +53,17 @@ DecoBenchApplication::DecoBenchApplication(const QString &library, Tests tests,
|
|||
kwinConfig.setGroup("Style");
|
||||
|
||||
plugins = new KDecorationPreviewPlugins( &kwinConfig );
|
||||
preview = new KDecorationPreview( 0 );
|
||||
preview = new KDecorationPreview( plugins, 0 );
|
||||
|
||||
if (plugins->loadPlugin(library) && preview->recreateDecoration(plugins) )
|
||||
kdDebug() << "decoration " << library << " created..." << endl;
|
||||
if (plugins->loadPlugin(library) )
|
||||
kdDebug() << "Decoration library " << library << " loaded..." << endl;
|
||||
else
|
||||
kdError() << "Error loading decoration library " << library << "!" << endl;
|
||||
|
||||
if (preview->recreateDecoration() )
|
||||
kdDebug() << "Decoration created..." << endl;
|
||||
else
|
||||
kdError() << "Error creating decoration!" << endl;
|
||||
|
||||
preview->show();
|
||||
}
|
||||
|
@ -79,6 +86,8 @@ void DecoBenchApplication::executeTest()
|
|||
preview->performCaptionTest(m_count);
|
||||
if (m_tests == AllTests || m_tests == ResizeTest)
|
||||
preview->performResizeTest(m_count);
|
||||
if (m_tests == AllTests || m_tests == RecreationTest)
|
||||
preview->performRecreationTest(m_count);
|
||||
|
||||
clock_t etime = clock();
|
||||
ftime(&aend);
|
||||
|
@ -114,6 +123,8 @@ int main(int argc, char** argv)
|
|||
test = CaptionTest;
|
||||
else if (t == "resize")
|
||||
test = ResizeTest;
|
||||
else if (t == "recreation")
|
||||
test = RecreationTest;
|
||||
else
|
||||
KCmdLineArgs::usage("Specify a valid test!");
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ enum Tests {
|
|||
AllTests,
|
||||
RepaintTest,
|
||||
CaptionTest,
|
||||
ResizeTest
|
||||
ResizeTest,
|
||||
RecreationTest
|
||||
};
|
||||
|
||||
class DecoBenchApplication : public KApplication
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
|
||||
// FRAME the preview doesn't update to reflect the changes done in the kcm
|
||||
|
||||
KDecorationPreview::KDecorationPreview( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name )
|
||||
KDecorationPreview::KDecorationPreview( KDecorationPlugins* plugin, QWidget* parent, const char* name )
|
||||
: QWidget( parent, name ),
|
||||
m_plugin(plugin)
|
||||
{
|
||||
options = new KDecorationPreviewOptions;
|
||||
|
||||
|
@ -94,10 +95,22 @@ void KDecorationPreview::performResizeTest(int n)
|
|||
}
|
||||
}
|
||||
|
||||
bool KDecorationPreview::recreateDecoration( KDecorationPlugins* plugins )
|
||||
void KDecorationPreview::performRecreationTest(int n)
|
||||
{
|
||||
kdDebug() << "start " << n << " resizes..." << endl;
|
||||
bridge->setCaption("Deco Benchmark");
|
||||
deco->captionChange();
|
||||
positionPreviews(0);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
recreateDecoration();
|
||||
kapp->processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
bool KDecorationPreview::recreateDecoration()
|
||||
{
|
||||
delete deco;
|
||||
deco = plugins->createDecoration(bridge);
|
||||
deco = m_plugin->createDecoration(bridge);
|
||||
deco->init();
|
||||
|
||||
if (!deco)
|
||||
|
|
|
@ -33,14 +33,15 @@ class KDecorationPreview
|
|||
: public QWidget
|
||||
{
|
||||
public:
|
||||
KDecorationPreview( QWidget* parent = NULL, const char* name = NULL );
|
||||
KDecorationPreview( KDecorationPlugins* plugin, QWidget* parent = NULL, const char* name = NULL );
|
||||
virtual ~KDecorationPreview();
|
||||
|
||||
void performRepaintTest(int n);
|
||||
void performCaptionTest(int n);
|
||||
void performResizeTest(int n);
|
||||
void performRecreationTest(int n);
|
||||
|
||||
bool recreateDecoration( KDecorationPlugins* plugin );
|
||||
bool recreateDecoration();
|
||||
void setPreviewMask( const QRegion&, int );
|
||||
QRegion unobscuredRegion( bool, const QRegion& ) const;
|
||||
QRect windowGeometry( bool ) const;
|
||||
|
@ -49,6 +50,7 @@ class KDecorationPreview
|
|||
KDecorationPreviewOptions* options;
|
||||
KDecorationPreviewBridge* bridge;
|
||||
KDecoration* deco;
|
||||
KDecorationPlugins* m_plugin;
|
||||
};
|
||||
|
||||
class KDecorationPreviewBridge
|
||||
|
|
Loading…
Reference in a new issue