/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi <nogu@users.sourceforge.jp>
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi <nogu@users.sourceforge.jp>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
QString StyleFill::command() const
{
- QString str = "set style fill ";
+ QString str = "set style fill";
if (style_ == EMPTY) {
- str += "empty ";
+ str += " empty";
} else if (style_ == SOLID) {
- str += "solid " + QString::number(density_) + ' ';
+ str += " solid " + QString::number(density_);
} else if (style_ == PATTERN) {
- str += "pattern " + QString::number(pattern_) + ' ';
+ str += " pattern " + QString::number(pattern_);
}
if (isBorder_) {
- str += "border";
- } else {
- str += "noborder";
+ str += " border";
if (lineType_ != DEFAULT_LINE_TYPE) {
str += ' ' + QString::number(lineType_);
}
+ } else {
+ str += " noborder";
}
return str;
}
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi <nogu@users.sourceforge.jp>
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi <nogu@users.sourceforge.jp>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
public:
StyleFill();
+ /// 塗りつぶさないように設定する
void setEmpty();
+ /*!
+ * \brief 塗りつぶさないかどうかを設定する
+ * \return 塗りつぶさないならば true
+ */
bool isEmpty() const;
+ /// 無地で塗りつぶすように設定する
void setSolid();
+ /*!
+ * \brief 無地で塗りつぶすかどうかを設定する
+ * \return 無地で塗りつぶすならば true
+ */
bool isSolid() const;
+ /*!
+ * \brief 塗りつぶしの濃さを設定する
+ * \param density 設定する塗りつぶしの濃さ
+ */
void setDensity(double density);
+ /*!
+ * \brief 塗りつぶしの濃さを得る
+ * \return 塗りつぶしの濃さ
+ */
double density() const;
+ /// パターンで塗りつぶすように設定する
void setPattern();
+ /*!
+ * \brief パターンで塗りつぶすかどうかを設定する
+ * \return パターンで塗りつぶすならば true
+ */
bool isPattern() const;
+ /*!
+ * \brief 塗りつぶしのパターンを設定する
+ * \param n 設定する塗りつぶしのパターン
+ */
void setPattern(int n);
+ /*!
+ * \brief 塗りつぶしのパターンを得る
+ * \return 塗りつぶしのパターン
+ */
int pattern() const;
+ /*!
+ * \brief 境界線を表示するかどうかを設定する
+ * \param border 境界線を表示するかどうか
+ */
void setBorder(bool border);
+ /*!
+ * \brief 境界線を表示するかどうかを返す
+ * \return 境界線を表示するならば true
+ */
bool isBorder() const;
+ /*!
+ * \brief 境界線の種類を設定する
+ * \param type 設定する境界線の種類
+ */
void setLineType(int type);
+ /*!
+ * \brief 境界線の種類を得る
+ * \return 境界線の種類
+ */
int lineType() const;
QString command() const;
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi <nogu@users.sourceforge.jp>
+ * Copyright (C) 2007, 2008, 2009 Muneyuki Noguchi <nogu@users.sourceforge.jp>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* Cueplot: a GUI front-end to gnuplot
- * Copyright (C) 2007 Muneyuki Noguchi <nogu@users.sourceforge.jp>
+ * Copyright (C) 2007, 2009 Muneyuki Noguchi <nogu@users.sourceforge.jp>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
public:
TerminalPbm();
+ /*!
+ * \brief フォントのサイズを設定する
+ * \param size 設定するフォントのサイズ
+ */
void setFontSize(int size);
+ /*!
+ * \brief フォントのサイズを得る
+ * \return フォントのサイズ
+ */
int fontSize() const;
+ /*!
+ * \brief モードを設定する
+ * \param mode 設定するモード
+ */
void setMode(int mode);
+ /*!
+ * \brief モードを得る
+ * \return モード
+ */
int mode() const;
//! フォントのサイズ
get_filename_component(filename ${test_file} NAME_WE)
add_test(${filename} opttests ${filename})
endforeach (test_file)
+
+add_subdirectory(style)
+add_subdirectory(terminal)
--- /dev/null
+include(${QT_USE_FILE})
+include_directories(../../../src/opt/style)
+
+set(test_file_list
+ stylefilltest.cpp
+)
+create_test_sourcelist(opt_style_tests optstyletests.cpp ${test_file_list})
+
+set(opt_style_file_list
+ ../../../src/opt/style/stylefill.cpp
+)
+add_executable(optstyletests ${opt_style_tests} ${opt_style_file_list})
+target_link_libraries(optstyletests ${QT_LIBRARIES})
+
+foreach (test_file ${test_file_list})
+ get_filename_component(filename ${test_file} NAME_WE)
+ add_test(${filename} optstyletests ${filename})
+endforeach (test_file)
--- /dev/null
+/*
+ * Cueplot: a GUI front-end to gnuplot
+ * Copyright (C) 2009 Muneyuki Noguchi <nogu@users.sourceforge.jp>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "stylefill.h"
+
+#include <QtCore/QString>
+
+int stylefilltest(int, char *[])
+{
+ StyleFill styleFill;
+ if (!styleFill.isEmpty()) {
+ return 1;
+ }
+ if (!styleFill.isBorder()) {
+ return 1;
+ }
+ if (styleFill.command() != "set style fill empty border") {
+ return 1;
+ }
+ styleFill.setSolid();
+ if (styleFill.command() != "set style fill solid 1 border") {
+ return 1;
+ }
+ styleFill.setDensity(0.25);
+ if (styleFill.command() != "set style fill solid 0.25 border") {
+ return 1;
+ }
+ styleFill.setPattern();
+ if (styleFill.command() != "set style fill pattern 0 border") {
+ return 1;
+ }
+ styleFill.setPattern(2);
+ if (styleFill.command() != "set style fill pattern 2 border") {
+ return 1;
+ }
+ styleFill.setBorder(false);
+ if (styleFill.command() != "set style fill pattern 2 noborder") {
+ return 1;
+ }
+ styleFill.setLineType(2);
+ if (styleFill.command() != "set style fill pattern 2 noborder") {
+ return 1;
+ }
+ styleFill.setBorder(true);
+ if (styleFill.command() != "set style fill pattern 2 border 2") {
+ return 1;
+ }
+ return 0;
+}
--- /dev/null
+include(${QT_USE_FILE})
+include_directories(../../../src/opt/terminal)
+
+set(test_file_list
+ terminalpbmtest.cpp
+)
+create_test_sourcelist(opt_terminal_tests
+ optterminaltests.cpp ${test_file_list}
+)
+
+set(opt_terminal_file_list
+ ../../../src/opt/terminal.cpp
+ ../../../src/opt/terminal/terminalpbm.cpp
+)
+add_executable(optterminaltests
+ ${opt_terminal_tests} ${opt_terminal_file_list}
+)
+target_link_libraries(optterminaltests ${QT_LIBRARIES})
+
+foreach (test_file ${test_file_list})
+ get_filename_component(filename ${test_file} NAME_WE)
+ add_test(${filename} optterminaltests ${filename})
+endforeach (test_file)
--- /dev/null
+/*
+ * Cueplot: a GUI front-end to gnuplot
+ * Copyright (C) 2009 Muneyuki Noguchi <nogu@users.sourceforge.jp>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "terminalpbm.h"
+
+#include <cstring> // strcmp()
+
+int terminalpbmtest(int, char *[])
+{
+ TerminalPbm terminalPbm;
+ if (terminalPbm.command() != "set terminal pbm small monochrome") {
+ return 1;
+ }
+ terminalPbm.setFontSize(0);
+ if (terminalPbm.command() != "set terminal pbm small monochrome") {
+ return 1;
+ }
+ if (std::strcmp(TerminalPbm::FONT_SIZE[0], "small")) {
+ return 1;
+ }
+ terminalPbm.setFontSize(1);
+ if (terminalPbm.command() != "set terminal pbm medium monochrome") {
+ return 1;
+ }
+ if (std::strcmp(TerminalPbm::FONT_SIZE[1], "medium")) {
+ return 1;
+ }
+ terminalPbm.setFontSize(2);
+ if (terminalPbm.command() != "set terminal pbm large monochrome") {
+ return 1;
+ }
+ if (std::strcmp(TerminalPbm::FONT_SIZE[2], "large")) {
+ return 1;
+ }
+ terminalPbm.setMode(0);
+ if (terminalPbm.command() != "set terminal pbm large monochrome") {
+ return 1;
+ }
+ if (std::strcmp(TerminalPbm::MODE[0], "monochrome")) {
+ return 1;
+ }
+ terminalPbm.setMode(1);
+ if (terminalPbm.command() != "set terminal pbm large gray") {
+ return 1;
+ }
+ if (std::strcmp(TerminalPbm::MODE[1], "gray")) {
+ return 1;
+ }
+ terminalPbm.setMode(2);
+ if (terminalPbm.command() != "set terminal pbm large color") {
+ return 1;
+ }
+ if (std::strcmp(TerminalPbm::MODE[2], "color")) {
+ return 1;
+ }
+ return 0;
+}