X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-style-monitor.cpp;h=a7e0b4637c16078bc2bbeee8077d04b010e1b056;hb=fc15ec07d0937a073085cfb763ba5d15c6ddbe1c;hp=ba0469d9bedf682ed6adecceae5b986e97aa8101;hpb=10213ff7b9185fbb7fd444c72c12dd4595b35204;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp index ba0469d..a7e0b46 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp @@ -15,9 +15,12 @@ * */ +// HEADER #include "toolkit-style-monitor.h" +// EXTERNAL INCLUDES #include +#include #include #include @@ -40,6 +43,19 @@ const char* DEFAULT_THEME= " }\n" "}\n"; +struct NamedTheme +{ + NamedTheme( const std::string& name, const std::string& theme ) + : name(name), theme(theme) + { + } + + std::string name; + std::string theme; +}; +typedef std::vector< NamedTheme > NamedThemes; +NamedThemes gThemes; + std::string gTheme; std::string gFontFamily = Dali::StyleMonitor::DEFAULT_FONT_FAMILY; std::string gFontStyle = Dali::StyleMonitor::DEFAULT_FONT_STYLE; @@ -81,9 +97,8 @@ public: // Signals private: Dali::StyleMonitor::StyleChangeSignalType mStyleChangeSignal; static Dali::StyleMonitor mToolkitStyleMonitor; - std::string mTheme; - std::string mOutput; //<<< Test output. Use SetThemeFileOutput in a testharness to use it. + std::string mTheme; ///<< Current theme name }; Dali::StyleMonitor StyleMonitor::mToolkitStyleMonitor; @@ -135,6 +150,16 @@ void StyleMonitor::SetTheme(std::string path) bool StyleMonitor::LoadThemeFile( const std::string& filename, std::string& output ) { + for( NamedThemes::iterator iter = gThemes.begin(); iter != gThemes.end(); ++iter ) + { + NamedTheme& theme = *iter; + if( theme.name == filename ) + { + output = theme.theme; + return true; + } + } + if( !gTheme.empty() ) { output = gTheme; @@ -246,9 +271,19 @@ namespace Test namespace StyleMonitor { -void SetThemeFileOutput( const std::string& output ) +void SetThemeFileOutput( const std::string& name, const std::string& output ) { - gTheme = output; + for( NamedThemes::iterator iter = gThemes.begin(); iter != gThemes.end(); ++iter ) + { + NamedTheme& theme = *iter; + if( theme.name == name ) + { + theme.theme = output; + return; + } + } + + gThemes.push_back( NamedTheme( name, output ) ); } void SetDefaultFontFamily(const std::string& family)