Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / onlinehelp / tests / helpformat.cpp
index aab131e2312e2523c5d5fb1e4333fd74fecf8c77..797593e6b899116ce3be98d93d914d508c279996 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
  *
  * GROMACS is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_onlinehelp
  */
-#include <gtest/gtest.h>
+#include "gmxpre.h"
 
 #include "gromacs/onlinehelp/helpformat.h"
 
+#include <gtest/gtest.h>
+
 #include "testutils/stringtest.h"
 
 namespace
@@ -135,6 +137,36 @@ TEST_F(TextTableFormatterTest, HandlesOverflowingLines)
     formatter_.setColumnFirstLineOffset(2, 2);
     formatter_.addColumnLine(3, g_wrapText2);
     checkText(formatter_.formatRow(), "FormattedRow3");
+    // Test a case where a column value overflows even the next column.
+    formatter_.addColumnLine(0, "foobarfoobar");
+    formatter_.addColumnLine(1, "barfoobarfoo");
+    formatter_.addColumnLine(2, g_wrapText);
+    formatter_.addColumnLine(3, g_wrapText2);
+    checkText(formatter_.formatRow(), "FormattedRow4");
+}
+
+TEST_F(TextTableFormatterTest, HandlesLastColumnFolding)
+{
+    setupStandardColumns();
+    formatter_.setFoldLastColumnToNextLine(4);
+    formatter_.clear();
+    formatter_.addColumnLine(0, "foo");
+    formatter_.addColumnLine(1, "bar");
+    formatter_.addColumnLine(2, "text");
+    formatter_.addColumnLine(3, g_wrapText);
+    checkText(formatter_.formatRow(), "FormattedTable");
+    formatter_.clear();
+    formatter_.addColumnLine(0, "foo");
+    formatter_.addColumnLine(1, "bar");
+    formatter_.addColumnLine(2, "text");
+    formatter_.addColumnLine(3, g_wrapText2);
+    checkText(formatter_.formatRow(), "FormattedRow2");
+    formatter_.clear();
+    formatter_.addColumnLine(0, "foo");
+    formatter_.addColumnLine(1, "bar");
+    formatter_.addColumnLine(2, "text");
+    formatter_.addColumnLine(3, "A quick brown fox jumps");
+    checkText(formatter_.formatRow(), "FormattedRow3");
 }
 
 TEST_F(TextTableFormatterTest, HandlesEmptyColumns)