SVN commit 1187623 by jsimon: New unit test for embedded horizontal bar chart M +1 -0 CMakeLists.txt M +5 -0 TestLoadingBase.cpp M +3 -1 TestLoadingBase.h M +9 -3 create-test A me07_percentage_stacked_bar_chart (directory) A me07_percentage_stacked_bar_chart/CMakeLists.txt A me07_percentage_stacked_bar_chart/TestLoading.cpp [License: LGPL (v2+)] A me07_percentage_stacked_bar_chart/TestLoading.h [License: LGPL (v2+)] A me07_percentage_stacked_bar_chart/doc (directory) A me07_percentage_stacked_bar_chart/doc/content.xml A me07_percentage_stacked_bar_chart/doc/meta.xml A me07_percentage_stacked_bar_chart/doc/styles.xml A me07_percentage_stacked_bar_chart/me07_percentage_stacked_bar_chart.ods --- trunk/koffice/plugins/chartshape/tests/odf/CMakeLists.txt #1187622:1187623 @@ -2,3 +2,4 @@ add_subdirectory( bug239802 ) add_subdirectory( default-koffice-chart ) add_subdirectory( bubble-chart ) +add_subdirectory( me07_percentage_stacked_bar_chart ) --- trunk/koffice/plugins/chartshape/tests/odf/TestLoadingBase.cpp #1187622:1187623 @@ -185,6 +185,11 @@ return m_chart->tableSource()->get( internalModel ); } +TableSource *TestLoadingBase::tableSource() +{ + return m_chart->tableSource(); +} + namespace QTest { template<> char *toString( const KChart::CellRegion ®ion ) { --- trunk/koffice/plugins/chartshape/tests/odf/TestLoadingBase.h #1187622:1187623 @@ -39,6 +39,7 @@ class ChartShape; class Table; +class TableSource; class Axis; /** @@ -61,7 +62,7 @@ TestLoadingBase(); protected slots: - void initTestCase(); + virtual void initTestCase(); protected: // Helper methods to be used by test functions @@ -93,6 +94,7 @@ void testAxisTitle( Axis *axis, const QString &text ); Table* internalTable(); + TableSource* tableSource(); ChartShape *m_chart; }; --- trunk/koffice/plugins/chartshape/tests/odf/create-test #1187622:1187623 @@ -56,13 +56,19 @@ # 4) Unzip document unzip "$doc" -d "$doc_path/orig" +# Remove object replacements, we don't need them and the directory name +# "ObjectReplacements" gets in the way of looking for objects with the pattern Object* +rm -rf "$doc_path/orig/ObjectReplacements" + # 5) Find chart document -# If Object* is expended to a valid directory name, this means there is only +# If Chart* or Object* is expended to a valid directory name, this means there is only # one embedded object, which we will assume is the chart. -chart_doc_path=`echo "$doc_path/orig/"Object_*` +chart_doc_path=`echo "$doc_path/orig/"Chart*` + if [ ! -d "$chart_doc_path" ]; then - chart_doc_path=`echo "$doc_path/orig/"Object\ *` + chart_doc_path=`echo "$doc_path/orig/"Object*` fi + if [ -d "$chart_doc_path" ]; then mv "$chart_doc_path/content.xml" "$doc_path/content.xml" mv "$chart_doc_path/styles.xml" "$doc_path/styles.xml"