From 253f13d46ed96dd9a4ed8619820d14098d547fc8 Mon Sep 17 00:00:00 2001 From: Mathias Gumz <akira at fluxbox dot org> Date: Fri, 18 Mar 2011 15:51:17 +0100 Subject: some love to src/tests, use automake to use the same build environment as the rest of fluxbox --- configure.in | 1 + src/tests/Makefile | 82 ---------------------- src/tests/Makefile.am | 22 ++++++ src/tests/StringUtiltest.cc | 4 +- src/tests/fullscreentest.cc | 15 +++-- src/tests/main.cc | 142 --------------------------------------- src/tests/testDemandAttention.cc | 18 ++--- src/tests/testFont.cc | 18 ++--- src/tests/texturetest.cc | 22 +++--- 9 files changed, 64 insertions(+), 260 deletions(-) delete mode 100644 src/tests/Makefile create mode 100644 src/tests/Makefile.am delete mode 100644 src/tests/main.cc diff --git a/configure.in b/configure.in index ea333be..d39ec77 100644 --- a/configure.in +++ b/configure.in @@ -711,6 +711,7 @@ AC_OUTPUT(Makefile version.h src/Makefile src/FbTk/Makefile +src/tests/Makefile util/Makefile util/fbrun/Makefile data/Makefile diff --git a/src/tests/Makefile b/src/tests/Makefile deleted file mode 100644 index dd329e6..0000000 --- a/src/tests/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -CXX=g++ -CXXFLAGS= -I.. -I../FbTk -I../.. -DDEBUG -DUSE_XFT -Wall -g -O2 -fno-inline -LIBS= -XFLAGS= -I/usr/X11R6/include -XLIBS= -L/usr/X11R6/lib -lX11 -lXft -lXpm -lImlib2 -COMPILEFILE=$(CXX) -c $(CXXFLAGS) -FONT_OBJ = ../FbTk/libFbTk.a -COMPILE = ${CXX} ${CXXFLAGS} ${XLIBS} - -all: testMenu testFont testTexture movetest testSignals - - -.cc.o: - $(CXX) -c $(CXXFLAGS) $< - -glxtest: ../FbTk/App.hh glxtest.cc - ${CXX} glxtest.cc ${CXXFLAGS} ${XLIBS} -lGL -lGLU -lXpm -o glxtest - -testSignals: testSignals.o ../FbTk/Signal.hh ../FbTk/MemFun.hh - $(CXX) $(LIBS) testSignals.o -o testSignals ../FbTk/libFbTk.a - -testStringUtil: StringUtiltest.o - $(CXX) $(LIBS) StringUtiltest.o ../FbTk/libFbTk.a -o testStringUtil - -testKeys: testKeys.o - $(CXX) $(LIBS) $(XLIBS) testKeys.o -o testKeys - -testResource: Resourcetest.o Resource.o - ${CXX} ${LIBS} ${XLIBS} Resourcetest.o Resource.o -o testResource - -testTitle: titletest.cc - ${CXX} ${CXXFLAGS} ${LIBS} ${XLIBS} titletest.cc ../FbTk/libFbTk.a -o testTitle - -signaltest: - ${COMPILE} ../FbTk/SignalHandler.o signaltest.cc -o signaltest - -testFont: testFont.cc ${FONT_OBJ} - ${CXX} testFont.cc -o testFont ${CXXFLAGS} ${XLIBS} - -testMenu: menutest.cc - ${CXX} menutest.cc -o testMenu ${CXXFLAGS} ${XLIBS} ../FbMenuParser.o ../FbTk/libFbTk.a -lXpm -lImlib2 ../Parser.o - -testLayers: testLayers.cc - ${CXX} ${CXXFLAGS} ${XLIBS} testLayers.cc ../FbTk/libFbTk.a -o testLayers - -testTransp: transpTest.cc - ${CXX} ${CXXFLAGS} ${XLIBS} transpTest.cc ../FbTk/libFbTk.a -o testTransp - -testScale: scaleTest.cc - ${CXX} ${CXXFLAGS} ${XLIBS} scaleTest.cc ../FbTk/libFbTk.a -lXpm -o testScale - -testTexture: texturetest.cc - ${COMPILE} texturetest.cc ../FbTk/libFbTk.a -lXpm -o testTexture - -testDemandAttention: testDemandAttention.cc - ${COMPILE} testDemandAttention.cc ../FbTk/libFbTk.a -lXpm -o testDemandAttention - -testFullscreen: fullscreentest.cc - ${COMPILE} fullscreentest.cc ../FbTk/libFbTk.a -o testFullscreen - -Parser.o: ../Parser.hh ../Parser.cc - ${COMPILE} ${CXXFLAGS} -c ../Parser.cc - -FbMenuParser.o: ../FbMenuParser.hh ../FbMenuParser.cc ../Parser.hh - ${COMPILE} ${CXXFLAGS} -c ../FbMenuParser.cc - -parsertest: parsertest.cc ../Parser.hh FbMenuParser.o Parser.o - ${COMPILE} parsertest.cc FbMenuParser.o Parser.o ../FbTk/StringUtil.o -o parsertest - -movetest: movetest.cc - ${COMPILE} movetest.cc ../FbTk/libFbTk.a -lXpm -o movetest - - -run: testLayers testResource testKeys testStringUtil testFont - ./testLayers - ./testKeys - ./testStringUtil - ./testResource - ./testSignal - ./testFont -clean: - rm -f *.o diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am new file mode 100644 index 0000000..85d42cf --- /dev/null +++ b/src/tests/Makefile.am @@ -0,0 +1,22 @@ +INCLUDES= -I.. + +noinst_PROGRAMS= \ + testTexture \ + testFont \ + testSignals \ + testKeys \ + testDemandAttention \ + testFullscreen \ + testStringUtil + +testTexture_SOURCES = texturetest.cc +testFont_SOURCES = testFont.cc +testSignals_SOURCES = testSignals.cc +testKeys_SOURCES = testKeys.cc +testDemandAttention_SOURCES = testDemandAttention.cc +#testResource_SOURCES = Resourcetest.cc +testFullscreen_SOURCES = fullscreentest.cc +testStringUtil_SOURCES = StringUtiltest.cc + +LDADD=../FbTk/libFbTk.a + diff --git a/src/tests/StringUtiltest.cc b/src/tests/StringUtiltest.cc index fb9caf8..a8d8d57 100644 --- a/src/tests/StringUtiltest.cc +++ b/src/tests/StringUtiltest.cc @@ -19,11 +19,13 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#include "StringUtil.hh" +#include "FbTk/StringUtil.hh" #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif //_GNU_SOURCE +#include <cstring> +#include <cstdlib> #include <vector> #include <iostream> #include <memory> diff --git a/src/tests/fullscreentest.cc b/src/tests/fullscreentest.cc index 038a71d..9f64db8 100644 --- a/src/tests/fullscreentest.cc +++ b/src/tests/fullscreentest.cc @@ -19,18 +19,19 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#include "App.hh" -#include "FbWindow.hh" -#include "Font.hh" -#include "EventHandler.hh" -#include "EventManager.hh" -#include "GContext.hh" -#include "Color.hh" +#include "FbTk/App.hh" +#include "FbTk/FbWindow.hh" +#include "FbTk/Font.hh" +#include "FbTk/EventHandler.hh" +#include "FbTk/EventManager.hh" +#include "FbTk/GContext.hh" +#include "FbTk/Color.hh" #include <X11/Xutil.h> #include <X11/keysym.h> #include <X11/Xatom.h> +#include <cstring> #include <string> #include <iostream> using namespace std; diff --git a/src/tests/main.cc b/src/tests/main.cc deleted file mode 100644 index 04e1363..0000000 --- a/src/tests/main.cc +++ /dev/null @@ -1,142 +0,0 @@ -// main.cc for testing menu in fluxbox -// Copyright (c) 2001 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -#include "../StringUtil.hh" - -#include <iostream> -#include <fstream> -#include <string> -#include <vector> - -using namespace std; - -bool loadMenu(string filename); -bool loadMenu2(string filename); - -void showError(int line, int pos, string& instr) { - - cerr<<"Error on line: "<<line<<endl; - cerr<<instr<<endl; - for (int c=0; c<pos; c++) { - if (instr[c]=='\t') - cerr<<'\t'; - else - cerr<<" "; - } - cerr<<"^ here"<<endl; - -} - -int main(int argc, char **argv) { - string filename = "menu"; - if (argc>1) - filename = argv[1]; - if (loadMenu2(filename)) - cout<<"Load successfull"<<endl; - else - cout<<"Load failed"<<endl; - -/* - string out; - vector<string> stringlist; - stringlist.push_back(" \t\t\t \t[(in \\)\t haha )] \t\t "); - stringlist.push_back("(in\\)) {_ _ my_ _}"); - stringlist.push_back("(in) {_ _ my_ _}"); - stringlist.push_back("(in){_ _ my_ _}"); - stringlist.push_back("\t \t \t ( in ) {haha}"); - stringlist.push_back("\t \t \t (( in \\) ) {haha}"); - stringlist.push_back("\t \t \t (( in \\) ){hihi}"); - stringlist.push_back("\t \t \t (( in \\) )|{hihi}"); - for (unsigned int i=0; i<stringlist.size(); i++) { - int pos = StringUtil::getStringBetween(out, stringlist[i].c_str(), '(', ')'); - int total_pos = 0; - if (pos<0) { - showError(i+1, -pos, stringlist[i]); - continue; - } - cerr<<"string="<<stringlist[i]<<endl; - cerr<<"pos="<<pos<<" ::"<<out; - total_pos += pos; - pos = StringUtil::getStringBetween(out, stringlist[i].c_str()+total_pos, '{', '}'); - if (pos<=0) { - pos=-pos; - showError(i+1, total_pos+pos, stringlist[i]); - continue; - } - cerr<<"::"<<out<<"::"<<endl; - total_pos += pos; - } -*/ - return 0; -} - - - -bool loadMenu2(string filename) { - - if (!filename.size()) - return false; - - ifstream menufile(filename.c_str()); - - - if (menufile) { - string instr; - vector<string> args; - int line=0; - while (!menufile.eof()) { - //read a line - getline(menufile, instr); - line++; - string arg; - int pos = StringUtil::getStringBetween(arg, instr.c_str(), '[', ']'); - if (pos<=0) { - showError(line, -pos, instr); - continue; - } - - cerr<<"("<<line<<"):"<<arg<<"::"; - int total_pos = pos; - pos = StringUtil::getStringBetween(arg, instr.c_str()+pos, '(', ')'); - if (pos<=0) { - showError(line, total_pos+(-pos), instr); - continue; - } - cerr<<arg<<"::"; - - total_pos +=pos; - pos = StringUtil::getStringBetween(arg, instr.c_str()+total_pos, '{', '}'); - if (pos<=0) { - total_pos = total_pos+(-pos); - showError(line, total_pos, instr); - continue; - } - cerr<<arg<<":"<<endl; - - } - - - } else - return false; - - return true; -} - diff --git a/src/tests/testDemandAttention.cc b/src/tests/testDemandAttention.cc index f90de30..10fadb3 100644 --- a/src/tests/testDemandAttention.cc +++ b/src/tests/testDemandAttention.cc @@ -19,15 +19,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#include "App.hh" -#include "FbWindow.hh" -#include "Font.hh" -#include "EventHandler.hh" -#include "EventManager.hh" -#include "GContext.hh" -#include "Color.hh" -#include "SimpleCommand.hh" -#include "Timer.hh" +#include "FbTk/App.hh" +#include "FbTk/FbWindow.hh" +#include "FbTk/Font.hh" +#include "FbTk/EventHandler.hh" +#include "FbTk/EventManager.hh" +#include "FbTk/GContext.hh" +#include "FbTk/Color.hh" +#include "FbTk/SimpleCommand.hh" +#include "FbTk/Timer.hh" #include <X11/Xutil.h> #include <X11/keysym.h> diff --git a/src/tests/testFont.cc b/src/tests/testFont.cc index f338751..1ba63f7 100644 --- a/src/tests/testFont.cc +++ b/src/tests/testFont.cc @@ -18,19 +18,21 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#include "App.hh" -#include "FbWindow.hh" -#include "Font.hh" -#include "EventHandler.hh" -#include "EventManager.hh" -#include "GContext.hh" -#include "Color.hh" -#include "FbString.hh" +#include "FbTk/App.hh" +#include "FbTk/FbWindow.hh" +#include "FbTk/Font.hh" +#include "FbTk/EventHandler.hh" +#include "FbTk/EventManager.hh" +#include "FbTk/GContext.hh" +#include "FbTk/Color.hh" +#include "FbTk/FbString.hh" #include <X11/Xutil.h> #include <X11/keysym.h> #include <string> +#include <cstring> +#include <cstdlib> #include <iostream> using namespace std; diff --git a/src/tests/texturetest.cc b/src/tests/texturetest.cc index 3fa6704..93680c0 100644 --- a/src/tests/texturetest.cc +++ b/src/tests/texturetest.cc @@ -1,17 +1,17 @@ // texturetest.cc a test app for Textures // Copyright (c) 2004 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -#include "ImageControl.hh" -#include "Color.hh" -#include "GContext.hh" -#include "FbPixmap.hh" -#include "Texture.hh" -#include "FbWindow.hh" -#include "EventHandler.hh" -#include "EventManager.hh" -#include "Theme.hh" -#include "Font.hh" -#include "App.hh" +#include "FbTk/ImageControl.hh" +#include "FbTk/Color.hh" +#include "FbTk/GContext.hh" +#include "FbTk/FbPixmap.hh" +#include "FbTk/Texture.hh" +#include "FbTk/FbWindow.hh" +#include "FbTk/EventHandler.hh" +#include "FbTk/EventManager.hh" +#include "FbTk/Theme.hh" +#include "FbTk/Font.hh" +#include "FbTk/App.hh" #include <stdlib.h> #include <string.h> -- cgit v0.11.2