diff --git a/tools/decobenchmark/main.cpp b/tools/decobenchmark/main.cpp index 7db2eb1530..8fa0e843e7 100644 --- a/tools/decobenchmark/main.cpp +++ b/tools/decobenchmark/main.cpp @@ -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!"); diff --git a/tools/decobenchmark/main.h b/tools/decobenchmark/main.h index f16f507041..65e6c742ba 100644 --- a/tools/decobenchmark/main.h +++ b/tools/decobenchmark/main.h @@ -25,7 +25,8 @@ enum Tests { AllTests, RepaintTest, CaptionTest, - ResizeTest + ResizeTest, + RecreationTest }; class DecoBenchApplication : public KApplication diff --git a/tools/decobenchmark/preview.cpp b/tools/decobenchmark/preview.cpp index 9d6c35e688..cec5af5052 100644 --- a/tools/decobenchmark/preview.cpp +++ b/tools/decobenchmark/preview.cpp @@ -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) diff --git a/tools/decobenchmark/preview.h b/tools/decobenchmark/preview.h index 0c4e100643..02974ebef6 100644 --- a/tools/decobenchmark/preview.h +++ b/tools/decobenchmark/preview.h @@ -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