some love to src/tests, use automake to use the same build environment as the rest of fluxbox

This commit is contained in:
Mathias Gumz 2011-03-18 15:51:17 +01:00
parent 81b240e976
commit 253f13d46e
9 changed files with 64 additions and 260 deletions

View file

@ -711,6 +711,7 @@ AC_OUTPUT(Makefile
version.h
src/Makefile
src/FbTk/Makefile
src/tests/Makefile
util/Makefile
util/fbrun/Makefile
data/Makefile

View file

@ -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

22
src/tests/Makefile.am Normal file
View file

@ -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

View file

@ -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>

View file

@ -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;

View file

@ -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;
}

View file

@ -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>

View file

@ -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;

View file

@ -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>