aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-03-18 14:51:17 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-03-18 14:51:17 (GMT)
commit253f13d46ed96dd9a4ed8619820d14098d547fc8 (patch)
treeb0d485fab64182be446d764d8adc211e8804eb55 /src
parent81b240e9762acde7e3682a6cec02932564d122f6 (diff)
downloadfluxbox_pavel-253f13d46ed96dd9a4ed8619820d14098d547fc8.zip
fluxbox_pavel-253f13d46ed96dd9a4ed8619820d14098d547fc8.tar.bz2
some love to src/tests, use automake to use the same build environment as the rest of fluxbox
Diffstat (limited to 'src')
-rw-r--r--src/tests/Makefile82
-rw-r--r--src/tests/Makefile.am22
-rw-r--r--src/tests/StringUtiltest.cc4
-rw-r--r--src/tests/fullscreentest.cc15
-rw-r--r--src/tests/main.cc142
-rw-r--r--src/tests/testDemandAttention.cc18
-rw-r--r--src/tests/testFont.cc18
-rw-r--r--src/tests/texturetest.cc22
8 files changed, 63 insertions, 260 deletions
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 @@
1CXX=g++
2CXXFLAGS= -I.. -I../FbTk -I../.. -DDEBUG -DUSE_XFT -Wall -g -O2 -fno-inline
3LIBS=
4XFLAGS= -I/usr/X11R6/include
5XLIBS= -L/usr/X11R6/lib -lX11 -lXft -lXpm -lImlib2
6COMPILEFILE=$(CXX) -c $(CXXFLAGS)
7FONT_OBJ = ../FbTk/libFbTk.a
8COMPILE = ${CXX} ${CXXFLAGS} ${XLIBS}
9
10all: testMenu testFont testTexture movetest testSignals
11
12
13.cc.o:
14 $(CXX) -c $(CXXFLAGS) $<
15
16glxtest: ../FbTk/App.hh glxtest.cc
17 ${CXX} glxtest.cc ${CXXFLAGS} ${XLIBS} -lGL -lGLU -lXpm -o glxtest
18
19testSignals: testSignals.o ../FbTk/Signal.hh ../FbTk/MemFun.hh
20 $(CXX) $(LIBS) testSignals.o -o testSignals ../FbTk/libFbTk.a
21
22testStringUtil: StringUtiltest.o
23 $(CXX) $(LIBS) StringUtiltest.o ../FbTk/libFbTk.a -o testStringUtil
24
25testKeys: testKeys.o
26 $(CXX) $(LIBS) $(XLIBS) testKeys.o -o testKeys
27
28testResource: Resourcetest.o Resource.o
29 ${CXX} ${LIBS} ${XLIBS} Resourcetest.o Resource.o -o testResource
30
31testTitle: titletest.cc
32 ${CXX} ${CXXFLAGS} ${LIBS} ${XLIBS} titletest.cc ../FbTk/libFbTk.a -o testTitle
33
34signaltest:
35 ${COMPILE} ../FbTk/SignalHandler.o signaltest.cc -o signaltest
36
37testFont: testFont.cc ${FONT_OBJ}
38 ${CXX} testFont.cc -o testFont ${CXXFLAGS} ${XLIBS}
39
40testMenu: menutest.cc
41 ${CXX} menutest.cc -o testMenu ${CXXFLAGS} ${XLIBS} ../FbMenuParser.o ../FbTk/libFbTk.a -lXpm -lImlib2 ../Parser.o
42
43testLayers: testLayers.cc
44 ${CXX} ${CXXFLAGS} ${XLIBS} testLayers.cc ../FbTk/libFbTk.a -o testLayers
45
46testTransp: transpTest.cc
47 ${CXX} ${CXXFLAGS} ${XLIBS} transpTest.cc ../FbTk/libFbTk.a -o testTransp
48
49testScale: scaleTest.cc
50 ${CXX} ${CXXFLAGS} ${XLIBS} scaleTest.cc ../FbTk/libFbTk.a -lXpm -o testScale
51
52testTexture: texturetest.cc
53 ${COMPILE} texturetest.cc ../FbTk/libFbTk.a -lXpm -o testTexture
54
55testDemandAttention: testDemandAttention.cc
56 ${COMPILE} testDemandAttention.cc ../FbTk/libFbTk.a -lXpm -o testDemandAttention
57
58testFullscreen: fullscreentest.cc
59 ${COMPILE} fullscreentest.cc ../FbTk/libFbTk.a -o testFullscreen
60
61Parser.o: ../Parser.hh ../Parser.cc
62 ${COMPILE} ${CXXFLAGS} -c ../Parser.cc
63
64FbMenuParser.o: ../FbMenuParser.hh ../FbMenuParser.cc ../Parser.hh
65 ${COMPILE} ${CXXFLAGS} -c ../FbMenuParser.cc
66
67parsertest: parsertest.cc ../Parser.hh FbMenuParser.o Parser.o
68 ${COMPILE} parsertest.cc FbMenuParser.o Parser.o ../FbTk/StringUtil.o -o parsertest
69
70movetest: movetest.cc
71 ${COMPILE} movetest.cc ../FbTk/libFbTk.a -lXpm -o movetest
72
73
74run: testLayers testResource testKeys testStringUtil testFont
75 ./testLayers
76 ./testKeys
77 ./testStringUtil
78 ./testResource
79 ./testSignal
80 ./testFont
81clean:
82 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 @@
1INCLUDES= -I..
2
3noinst_PROGRAMS= \
4 testTexture \
5 testFont \
6 testSignals \
7 testKeys \
8 testDemandAttention \
9 testFullscreen \
10 testStringUtil
11
12testTexture_SOURCES = texturetest.cc
13testFont_SOURCES = testFont.cc
14testSignals_SOURCES = testSignals.cc
15testKeys_SOURCES = testKeys.cc
16testDemandAttention_SOURCES = testDemandAttention.cc
17#testResource_SOURCES = Resourcetest.cc
18testFullscreen_SOURCES = fullscreentest.cc
19testStringUtil_SOURCES = StringUtiltest.cc
20
21LDADD=../FbTk/libFbTk.a
22
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 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22#include "StringUtil.hh" 22#include "FbTk/StringUtil.hh"
23#ifndef _GNU_SOURCE 23#ifndef _GNU_SOURCE
24#define _GNU_SOURCE 24#define _GNU_SOURCE
25#endif //_GNU_SOURCE 25#endif //_GNU_SOURCE
26 26
27#include <cstring>
28#include <cstdlib>
27#include <vector> 29#include <vector>
28#include <iostream> 30#include <iostream>
29#include <memory> 31#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 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22#include "App.hh" 22#include "FbTk/App.hh"
23#include "FbWindow.hh" 23#include "FbTk/FbWindow.hh"
24#include "Font.hh" 24#include "FbTk/Font.hh"
25#include "EventHandler.hh" 25#include "FbTk/EventHandler.hh"
26#include "EventManager.hh" 26#include "FbTk/EventManager.hh"
27#include "GContext.hh" 27#include "FbTk/GContext.hh"
28#include "Color.hh" 28#include "FbTk/Color.hh"
29 29
30#include <X11/Xutil.h> 30#include <X11/Xutil.h>
31#include <X11/keysym.h> 31#include <X11/keysym.h>
32#include <X11/Xatom.h> 32#include <X11/Xatom.h>
33 33
34#include <cstring>
34#include <string> 35#include <string>
35#include <iostream> 36#include <iostream>
36using namespace std; 37using 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 @@
1// main.cc for testing menu in fluxbox
2// Copyright (c) 2001 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#include "../StringUtil.hh"
23
24#include <iostream>
25#include <fstream>
26#include <string>
27#include <vector>
28
29using namespace std;
30
31bool loadMenu(string filename);
32bool loadMenu2(string filename);
33
34void showError(int line, int pos, string& instr) {
35
36 cerr<<"Error on line: "<<line<<endl;
37 cerr<<instr<<endl;
38 for (int c=0; c<pos; c++) {
39 if (instr[c]=='\t')
40 cerr<<'\t';
41 else
42 cerr<<" ";
43 }
44 cerr<<"^ here"<<endl;
45
46}
47
48int main(int argc, char **argv) {
49 string filename = "menu";
50 if (argc>1)
51 filename = argv[1];
52 if (loadMenu2(filename))
53 cout<<"Load successfull"<<endl;
54 else
55 cout<<"Load failed"<<endl;
56
57/*
58 string out;
59 vector<string> stringlist;
60 stringlist.push_back(" \t\t\t \t[(in \\)\t haha )] \t\t ");
61 stringlist.push_back("(in\\)) {_ _ my_ _}");
62 stringlist.push_back("(in) {_ _ my_ _}");
63 stringlist.push_back("(in){_ _ my_ _}");
64 stringlist.push_back("\t \t \t ( in ) {haha}");
65 stringlist.push_back("\t \t \t (( in \\) ) {haha}");
66 stringlist.push_back("\t \t \t (( in \\) ){hihi}");
67 stringlist.push_back("\t \t \t (( in \\) )|{hihi}");
68 for (unsigned int i=0; i<stringlist.size(); i++) {
69 int pos = StringUtil::getStringBetween(out, stringlist[i].c_str(), '(', ')');
70 int total_pos = 0;
71 if (pos<0) {
72 showError(i+1, -pos, stringlist[i]);
73 continue;
74 }
75 cerr<<"string="<<stringlist[i]<<endl;
76 cerr<<"pos="<<pos<<" ::"<<out;
77 total_pos += pos;
78 pos = StringUtil::getStringBetween(out, stringlist[i].c_str()+total_pos, '{', '}');
79 if (pos<=0) {
80 pos=-pos;
81 showError(i+1, total_pos+pos, stringlist[i]);
82 continue;
83 }
84 cerr<<"::"<<out<<"::"<<endl;
85 total_pos += pos;
86 }
87*/
88 return 0;
89}
90
91
92
93bool loadMenu2(string filename) {
94
95 if (!filename.size())
96 return false;
97
98 ifstream menufile(filename.c_str());
99
100
101 if (menufile) {
102 string instr;
103 vector<string> args;
104 int line=0;
105 while (!menufile.eof()) {
106 //read a line
107 getline(menufile, instr);
108 line++;
109 string arg;
110 int pos = StringUtil::getStringBetween(arg, instr.c_str(), '[', ']');
111 if (pos<=0) {
112 showError(line, -pos, instr);
113 continue;
114 }
115
116 cerr<<"("<<line<<"):"<<arg<<"::";
117 int total_pos = pos;
118 pos = StringUtil::getStringBetween(arg, instr.c_str()+pos, '(', ')');
119 if (pos<=0) {
120 showError(line, total_pos+(-pos), instr);
121 continue;
122 }
123 cerr<<arg<<"::";
124
125 total_pos +=pos;
126 pos = StringUtil::getStringBetween(arg, instr.c_str()+total_pos, '{', '}');
127 if (pos<=0) {
128 total_pos = total_pos+(-pos);
129 showError(line, total_pos, instr);
130 continue;
131 }
132 cerr<<arg<<":"<<endl;
133
134 }
135
136
137 } else
138 return false;
139
140 return true;
141}
142
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 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22#include "App.hh" 22#include "FbTk/App.hh"
23#include "FbWindow.hh" 23#include "FbTk/FbWindow.hh"
24#include "Font.hh" 24#include "FbTk/Font.hh"
25#include "EventHandler.hh" 25#include "FbTk/EventHandler.hh"
26#include "EventManager.hh" 26#include "FbTk/EventManager.hh"
27#include "GContext.hh" 27#include "FbTk/GContext.hh"
28#include "Color.hh" 28#include "FbTk/Color.hh"
29#include "SimpleCommand.hh" 29#include "FbTk/SimpleCommand.hh"
30#include "Timer.hh" 30#include "FbTk/Timer.hh"
31 31
32#include <X11/Xutil.h> 32#include <X11/Xutil.h>
33#include <X11/keysym.h> 33#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 @@
18// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19// DEALINGS IN THE SOFTWARE. 19// DEALINGS IN THE SOFTWARE.
20 20
21#include "App.hh" 21#include "FbTk/App.hh"
22#include "FbWindow.hh" 22#include "FbTk/FbWindow.hh"
23#include "Font.hh" 23#include "FbTk/Font.hh"
24#include "EventHandler.hh" 24#include "FbTk/EventHandler.hh"
25#include "EventManager.hh" 25#include "FbTk/EventManager.hh"
26#include "GContext.hh" 26#include "FbTk/GContext.hh"
27#include "Color.hh" 27#include "FbTk/Color.hh"
28#include "FbString.hh" 28#include "FbTk/FbString.hh"
29 29
30#include <X11/Xutil.h> 30#include <X11/Xutil.h>
31#include <X11/keysym.h> 31#include <X11/keysym.h>
32 32
33#include <string> 33#include <string>
34#include <cstring>
35#include <cstdlib>
34#include <iostream> 36#include <iostream>
35using namespace std; 37using namespace std;
36 38
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 @@
1// texturetest.cc a test app for Textures 1// texturetest.cc a test app for Textures
2// Copyright (c) 2004 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2004 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
3 3
4#include "ImageControl.hh" 4#include "FbTk/ImageControl.hh"
5#include "Color.hh" 5#include "FbTk/Color.hh"
6#include "GContext.hh" 6#include "FbTk/GContext.hh"
7#include "FbPixmap.hh" 7#include "FbTk/FbPixmap.hh"
8#include "Texture.hh" 8#include "FbTk/Texture.hh"
9#include "FbWindow.hh" 9#include "FbTk/FbWindow.hh"
10#include "EventHandler.hh" 10#include "FbTk/EventHandler.hh"
11#include "EventManager.hh" 11#include "FbTk/EventManager.hh"
12#include "Theme.hh" 12#include "FbTk/Theme.hh"
13#include "Font.hh" 13#include "FbTk/Font.hh"
14#include "App.hh" 14#include "FbTk/App.hh"
15 15
16#include <stdlib.h> 16#include <stdlib.h>
17#include <string.h> 17#include <string.h>