lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master bb36d25 02/13: Assert that measure-only and r


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bb36d25 02/13: Assert that measure-only and render passes have the same side effects
Date: Tue, 8 May 2018 19:51:05 -0400 (EDT)

branch: master
commit bb36d25613aaf667f596cd792d6d64ebca8e6bf8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Assert that measure-only and render passes have the same side effects
---
 wx_table_generator.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 25c8b07..b822816 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -751,12 +751,14 @@ void wx_table_generator::output_header
     ,oenum_render_or_only_measure output_mode
     )
 {
+    int const anticipated_pos_y = *pos_y + row_height() * max_header_lines_;
+
     switch(output_mode)
         {
         case oe_render:
             break;
         case oe_only_measure:
-            *pos_y += max_header_lines_ * row_height_;
+            *pos_y = anticipated_pos_y;
             return;
         }
 
@@ -809,6 +811,8 @@ void wx_table_generator::output_header
         do_output_horz_separator(left_margin_, x, *pos_y - 1);
         do_output_horz_separator(left_margin_, x, *pos_y    );
         }
+
+    LMI_ASSERT(anticipated_pos_y == *pos_y);
 }
 
 void wx_table_generator::output_super_header
@@ -820,13 +824,14 @@ void wx_table_generator::output_super_header
         )
 {
     std::vector<std::string> const lines(split_into_lines(header));
+    int const anticipated_pos_y = *pos_y + row_height() * lines.size();
 
     switch(output_mode)
         {
         case oe_render:
             break;
         case oe_only_measure:
-            *pos_y += row_height_ * lines.size();
+            *pos_y = anticipated_pos_y;
             return;
         }
 
@@ -844,6 +849,8 @@ void wx_table_generator::output_super_header
         rect.y += row_height_;
         *pos_y += row_height_;
         }
+
+    LMI_ASSERT(anticipated_pos_y == *pos_y);
 }
 
 void wx_table_generator::output_row



reply via email to

[Prev in Thread] Current Thread [Next in Thread]