/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012, by the GROMACS development team, led by
+ * 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.
* \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
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)