[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master a074fd5 1/3: Document a contract and the meas
[lmi-commits] [lmi] master a074fd5 1/3: Document a contract and the measures taken to test it
Tue, 24 Apr 2018 18:40:01 -0400 (EDT)
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Document a contract and the measures taken to test it
Added an assertion to ensure that part of the contract is fulfilled.
wx_table_generator.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index a38d0c4..ef630af 100644
@@ -82,6 +82,8 @@ void wx_table_generator::add_column
,std::string const& widest_text
// There is no need to care about the column width for hidden columns.
@@ -193,7 +195,16 @@ wxRect wx_table_generator::text_rect(std::size_t column,
/// Compute column widths.
-/// This function is to be called exactly once. Reason...
+/// This function must be called after the last time add_column() is
+/// called, and before the first time that the column widths it sets
+/// are used. It is assumed to be fairly expensive, so that it should
+/// be called only once. There seems to be no simple way to impose
+/// those synchronization requirements upon clients, so
+/// - add_column() asserts that this function hasn't yet been called;
+/// - this function exits early if it has already been called.
+/// Thus, any violation of the first part of this contract is detected
+/// at run time. It is hoped that this function is called in enough
+/// places to fulfill the second part of the contract.