Boost logo

Boost-Commit :

From: JakeVoytko_at_[hidden]
Date: 2007-08-08 17:43:33


Author: jakevoytko
Date: 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
New Revision: 38543
URL: http://svn.boost.org/trac/boost/changeset/38543

Log:
Added some unit tests, minor modifications to *plot.hpp

Added:
   sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp (contents, props changed)
   sandbox/SOC/2007/visualization/libs/svg_plot/test/2d_color_consistency.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 25 +++++++++++++------------
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp | 1 +
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 2 +-
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 31 ++++++++++++++++++++++++++++++-
   sandbox/SOC/2007/visualization/libs/svg_plot/test/Jamfile.v2 | 7 ++++---
   5 files changed, 49 insertions(+), 17 deletions(-)

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -455,6 +455,7 @@
             case square:
                 g_ptr.rect(_x - half_size, _y - half_size, size, size);
                 break;
+ default: break;
         }
     }
 
@@ -776,62 +777,62 @@
     // color information
     svg_color get_title_color()
     {
- return derived().image.get_g_element(PLOT_TITLE).style().get_fill_color();
+ return derived().image.get_g_element(PLOT_TITLE).style().fill_color();
     }
 
     svg_color get_background_color()
     {
- return derived().image.get_g_element(PLOT_BACKGROUND).style().get_fill_color();
+ return derived().image.get_g_element(PLOT_BACKGROUND).style().fill_color();
     }
 
     svg_color get_background_border_color()
     {
- return derived().image.get_g_element(PLOT_BACKGROUND).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_BACKGROUND).style().stroke_color();
     }
 
     svg_color get_legend_background_color()
     {
- return derived().image.get_g_element(PLOT_LEGEND_BACKGROUND).style().get_fill_color();
+ return derived().image.get_g_element(PLOT_LEGEND_BACKGROUND).style().fill_color();
     }
 
     svg_color get_legend_border_color()
     {
- return derived().image.get_g_element(PLOT_LEGEND_BACKGROUND).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_LEGEND_BACKGROUND).style().stroke_color();
     }
 
     svg_color get_plot_background_color()
     {
- return derived().image.get_g_element(PLOT_PLOT_BACKGROUND).style().get_fill_color();
+ return derived().image.get_g_element(PLOT_PLOT_BACKGROUND).style().fill_color();
     }
 
     svg_color get_x_axis_color()
     {
- return derived().image.get_g_element(PLOT_X_AXIS).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_X_AXIS).style().stroke_color();
     }
 
     svg_color get_x_label_color()
     {
- return derived().image.get_g_element(PLOT_X_LABEL).style().get_fill_color();
+ return derived().image.get_g_element(PLOT_X_LABEL).style().stroke_color();
     }
 
     svg_color get_x_major_tick_color()
     {
- return derived().image.get_g_element(PLOT_X_MAJOR_TICKS).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_X_MAJOR_TICKS).style().stroke_color();
     }
 
     svg_color get_x_minor_tick_color()
     {
- return derived().image.get_g_element(PLOT_X_MINOR_TICKS).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_X_MINOR_TICKS).style().stroke_color();
     }
 
     svg_color get_x_major_grid_color()
     {
- return derived().image.get_g_element(PLOT_X_MAJOR_GRID).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_X_MAJOR_GRID).style().stroke_color();
     }
 
     svg_color get_x_minor_grid_color()
     {
- return derived().image.get_g_element(PLOT_X_MINOR_GRID).style().get_stroke_color();
+ return derived().image.get_g_element(PLOT_X_MINOR_GRID).style().stroke_color();
     }
 
     // axis information

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -10,6 +10,7 @@
 #define _BOOST_SVG_NUMERIC_LIMITS_HANDLING_DETAIL_HPP
 
 #include <limits>
+#include <cmath>
 
 namespace boost{
 namespace svg{

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -124,7 +124,7 @@
         {
             temp = *i;
 
- if(is_limit(temp))
+ if(detail::is_limit(temp))
             {
                 series_limits.push_back(temp);
             }

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -72,7 +72,7 @@
 
     double i;
 
- double start(double _i)
+ void start(double _i)
     {
         i = _i;
     }
@@ -946,6 +946,35 @@
     return *this;
 }
 
+svg_color get_y_axis_color()
+{
+ return image.get_g_element(detail::PLOT_Y_AXIS).style().stroke_color();
+}
+
+svg_color get_y_label_color()
+{
+ return image.get_g_element(detail::PLOT_Y_LABEL).style().stroke_color();
+}
+
+svg_color get_y_major_tick_color()
+{
+ return image.get_g_element(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color();
+}
+
+svg_color get_y_minor_tick_color()
+{
+ return image.get_g_element(detail::PLOT_Y_MINOR_TICKS).style().stroke_color();
+}
+
+svg_color get_y_major_grid_color()
+{
+ return image.get_g_element(detail::PLOT_Y_MAJOR_GRID).style().stroke_color();
+}
+
+svg_color get_y_minor_grid_color()
+{
+ return image.get_g_element(detail::PLOT_Y_MINOR_GRID).style().stroke_color();
+}
 #if defined (BOOST_MSVC)
 # pragma warning(push)
 # pragma warning(disable: 4100) // "'boost_parameter_enabler_argument' : unreferenced formal parameter"

Added: sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/test/1d_color_consistency.cpp 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -0,0 +1,73 @@
+// 1d_color_consistency.cpp
+// Copyright (C) Jacob Voytko 2007
+// Distributed under the Boost Software License, Version 1.0.
+// For more information, see http://www.boost.org
+// -----------------------------------------------------------------
+#include <boost/svg_plot/svg_1d_plot.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+using namespace boost::svg;
+
+int test_main(int, char*[])
+{
+ svg_1d_plot my_plot;
+
+ my_plot
+ .background_border_color(svg_color(0, 0, 1))
+ .background_color(svg_color(0, 0, 2))
+ .legend_background_color(svg_color(0, 0, 3))
+ .legend_border_color(svg_color(0, 0, 4))
+ .plot_background_color(svg_color(0, 0, 5))
+ .title_color(svg_color(0, 0, 6))
+ .x_axis_color(svg_color(0, 0, 7))
+ .x_label_color(svg_color(0, 0, 8))
+ .x_major_grid_color(svg_color(0, 0, 9))
+ .x_major_tick_color(svg_color(0, 0, 10))
+ .x_minor_grid_color(svg_color(0, 0, 11))
+ .x_minor_tick_color(svg_color(0, 0, 12));
+
+ BOOST_CHECK(my_plot.get_background_border_color()==svg_color(0, 0, 1));
+ BOOST_CHECK(my_plot.get_background_color()==svg_color(0, 0, 2));
+ BOOST_CHECK(my_plot.get_legend_background_color()==svg_color(0, 0, 3));
+ BOOST_CHECK(my_plot.get_legend_border_color()==svg_color(0, 0, 4));
+ BOOST_CHECK(my_plot.get_plot_background_color()==svg_color(0, 0, 5));
+ BOOST_CHECK(my_plot.get_title_color()==svg_color(0, 0, 6));
+ BOOST_CHECK(my_plot.get_x_axis_color()==svg_color(0, 0, 7));
+ BOOST_CHECK(my_plot.get_x_label_color()==svg_color(0, 0, 8));
+ BOOST_CHECK(my_plot.get_x_major_grid_color()==svg_color(0, 0, 9));
+ BOOST_CHECK(my_plot.get_x_major_tick_color()==svg_color(0, 0, 10));
+ BOOST_CHECK(my_plot.get_x_minor_grid_color()==svg_color(0, 0, 11));
+ BOOST_CHECK(my_plot.get_x_minor_tick_color()==svg_color(0, 0, 12));
+
+ my_plot
+ .x_minor_tick_color(svg_color(0, 0, 12))
+ .x_minor_grid_color(svg_color(0, 0, 11))
+ .x_major_tick_color(svg_color(0, 0, 10))
+ .x_major_grid_color(svg_color(0, 0, 9))
+ .x_label_color(svg_color(0, 0, 8))
+ .x_axis_color(svg_color(0, 0, 7))
+ .title_color(svg_color(0, 0, 6))
+ .plot_background_color(svg_color(0, 0, 5))
+ .legend_border_color(svg_color(0, 0, 4))
+ .legend_background_color(svg_color(0, 0, 3))
+ .background_color(svg_color(0, 0, 2))
+ .background_border_color(svg_color(0, 0, 1));
+
+ BOOST_CHECK(my_plot.get_x_minor_tick_color()==svg_color(0, 0, 12));
+ BOOST_CHECK(my_plot.get_x_minor_grid_color()==svg_color(0, 0, 11));
+ BOOST_CHECK(my_plot.get_x_major_tick_color()==svg_color(0, 0, 10));
+ BOOST_CHECK(my_plot.get_x_major_grid_color()==svg_color(0, 0, 9));
+ BOOST_CHECK(my_plot.get_x_label_color()==svg_color(0, 0, 8));
+ BOOST_CHECK(my_plot.get_x_axis_color()==svg_color(0, 0, 7));
+ BOOST_CHECK(my_plot.get_title_color()==svg_color(0, 0, 6));
+ BOOST_CHECK(my_plot.get_plot_background_color()==svg_color(0, 0, 5));
+ BOOST_CHECK(my_plot.get_legend_border_color()==svg_color(0, 0, 4));
+ BOOST_CHECK(my_plot.get_legend_background_color()==svg_color(0, 0, 3));
+ BOOST_CHECK(my_plot.get_background_color()==svg_color(0, 0, 2));
+ BOOST_CHECK(my_plot.get_background_border_color()==svg_color(0, 0, 1));
+ return 0;
+}
+
+
+//**passed** ../../../bin.v2/libs/svg_plot/test/1d_color_consistency.test/gcc-4.1.2/debug/1d_color_consistency.test
+

Added: sandbox/SOC/2007/visualization/libs/svg_plot/test/2d_color_consistency.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/test/2d_color_consistency.cpp 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -0,0 +1,95 @@
+// 2d_color_consistency.cpp
+// Copyright (C) Jacob Voytko 2007
+// Distributed under the Boost Software License, Version 1.0.
+// For more information, see http://www.boost.org
+// -----------------------------------------------------------------
+#include <boost/svg_plot/svg_2d_plot.hpp>
+#include <boost/test/included/test_exec_monitor.hpp>
+
+using namespace boost::svg;
+
+int test_main(int, char*[])
+{
+ svg_2d_plot my_plot;
+
+ my_plot
+ .background_border_color(svg_color(0, 0, 1))
+ .background_color(svg_color(0, 0, 2))
+ .legend_background_color(svg_color(0, 0, 3))
+ .legend_border_color(svg_color(0, 0, 4))
+ .plot_background_color(svg_color(0, 0, 5))
+ .title_color(svg_color(0, 0, 6))
+ .x_axis_color(svg_color(0, 0, 7))
+ .x_label_color(svg_color(0, 0, 8))
+ .x_major_grid_color(svg_color(0, 0, 9))
+ .x_major_tick_color(svg_color(0, 0, 10))
+ .x_minor_grid_color(svg_color(0, 0, 11))
+ .x_minor_tick_color(svg_color(0, 0, 12))
+ .y_axis_color(svg_color(0, 0, 13))
+// .y_label_color(svg_color(0, 0, 14))
+ .y_major_grid_color(svg_color(0, 0, 15))
+ .y_major_tick_color(svg_color(0, 0, 16))
+ .y_minor_grid_color(svg_color(0, 0, 17))
+ .y_minor_tick_color(svg_color(0, 0, 18));
+
+ BOOST_CHECK(my_plot.get_background_border_color()==svg_color(0, 0, 1));
+ BOOST_CHECK(my_plot.get_background_color()==svg_color(0, 0, 2));
+ BOOST_CHECK(my_plot.get_legend_background_color()==svg_color(0, 0, 3));
+ BOOST_CHECK(my_plot.get_legend_border_color()==svg_color(0, 0, 4));
+ BOOST_CHECK(my_plot.get_plot_background_color()==svg_color(0, 0, 5));
+ BOOST_CHECK(my_plot.get_title_color()==svg_color(0, 0, 6));
+ BOOST_CHECK(my_plot.get_x_axis_color()==svg_color(0, 0, 7));
+ BOOST_CHECK(my_plot.get_x_label_color()==svg_color(0, 0, 8));
+ BOOST_CHECK(my_plot.get_x_major_grid_color()==svg_color(0, 0, 9));
+ BOOST_CHECK(my_plot.get_x_major_tick_color()==svg_color(0, 0, 10));
+ BOOST_CHECK(my_plot.get_x_minor_grid_color()==svg_color(0, 0, 11));
+ BOOST_CHECK(my_plot.get_x_minor_tick_color()==svg_color(0, 0, 12));
+ BOOST_CHECK(my_plot.get_y_axis_color()==svg_color(0, 0, 13));
+// BOOST_CHECK(my_plot.get_y_label_color()==svg_color(0, 0, 14));
+ BOOST_CHECK(my_plot.get_y_major_grid_color()==svg_color(0, 0, 15));
+ BOOST_CHECK(my_plot.get_y_major_tick_color()==svg_color(0, 0, 16));
+ BOOST_CHECK(my_plot.get_y_minor_grid_color()==svg_color(0, 0, 17));
+ BOOST_CHECK(my_plot.get_y_minor_tick_color()==svg_color(0, 0, 18));
+
+ my_plot
+ .y_minor_tick_color(svg_color(0, 0, 18))
+ .y_minor_grid_color(svg_color(0, 0, 17))
+ .y_major_tick_color(svg_color(0, 0, 16))
+ .y_major_grid_color(svg_color(0, 0, 15))
+// .y_label_color(svg_color(0, 0, 14))
+ .y_axis_color(svg_color(0, 0, 13))
+ .x_minor_tick_color(svg_color(0, 0, 12))
+ .x_minor_grid_color(svg_color(0, 0, 11))
+ .x_major_tick_color(svg_color(0, 0, 10))
+ .x_major_grid_color(svg_color(0, 0, 9))
+ .x_label_color(svg_color(0, 0, 8))
+ .x_axis_color(svg_color(0, 0, 7))
+ .title_color(svg_color(0, 0, 6))
+ .plot_background_color(svg_color(0, 0, 5))
+ .legend_border_color(svg_color(0, 0, 4))
+ .legend_background_color(svg_color(0, 0, 3))
+ .background_color(svg_color(0, 0, 2))
+ .background_border_color(svg_color(0, 0, 1));
+
+ BOOST_CHECK(my_plot.get_y_minor_tick_color()==svg_color(0, 0, 18));
+ BOOST_CHECK(my_plot.get_y_minor_grid_color()==svg_color(0, 0, 17));
+ BOOST_CHECK(my_plot.get_y_major_tick_color()==svg_color(0, 0, 16));
+ BOOST_CHECK(my_plot.get_y_major_grid_color()==svg_color(0, 0, 15));
+// BOOST_CHECK(my_plot.get_y_label_color()==svg_color(0, 0, 14));
+ BOOST_CHECK(my_plot.get_y_axis_color()==svg_color(0, 0, 13));
+ BOOST_CHECK(my_plot.get_x_minor_tick_color()==svg_color(0, 0, 12));
+ BOOST_CHECK(my_plot.get_x_minor_grid_color()==svg_color(0, 0, 11));
+ BOOST_CHECK(my_plot.get_x_major_tick_color()==svg_color(0, 0, 10));
+ BOOST_CHECK(my_plot.get_x_major_grid_color()==svg_color(0, 0, 9));
+ BOOST_CHECK(my_plot.get_x_label_color()==svg_color(0, 0, 8));
+ BOOST_CHECK(my_plot.get_x_axis_color()==svg_color(0, 0, 7));
+ BOOST_CHECK(my_plot.get_title_color()==svg_color(0, 0, 6));
+ BOOST_CHECK(my_plot.get_plot_background_color()==svg_color(0, 0, 5));
+ BOOST_CHECK(my_plot.get_legend_border_color()==svg_color(0, 0, 4));
+ BOOST_CHECK(my_plot.get_legend_background_color()==svg_color(0, 0, 3));
+ BOOST_CHECK(my_plot.get_background_color()==svg_color(0, 0, 2));
+ BOOST_CHECK(my_plot.get_background_border_color()==svg_color(0, 0, 1));
+ return 0;
+}
+
+//**passed** ../../../bin.v2/libs/svg_plot/test/2d_color_consistency.test/gcc-4.1.2/debug/2d_color_consistency.test

Modified: sandbox/SOC/2007/visualization/libs/svg_plot/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/test/Jamfile.v2 (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/test/Jamfile.v2 2007-08-08 17:43:27 EDT (Wed, 08 Aug 2007)
@@ -5,11 +5,12 @@
 
 import testing ;
 
+#change to BOOST_ROOT
 project
     : requirements
       <include>../../..
+ <include>$BOOST_ROOT
     ;
 
-run test_color_constant.cpp ;
-run test_color_persistance.cpp ;
-run test_color_consistency.cpp ;
+run 1d_color_consistency.cpp ;
+run 2d_color_consistency.cpp ;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk