linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05166
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2800: Add dwt test
------------------------------------------------------------
revno: 2800
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sun 2012-01-08 13:00:31 +0100
message:
Add dwt test
removed:
dwt/SConscript
added:
dwt/test/
dwt/test/SConscript
dwt/test/TableTest.cpp
modified:
SConstruct
build_util.py
dwt/src/SConscript
utils/SConscript
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct 2012-01-08 10:19:19 +0000
+++ SConstruct 2012-01-08 12:00:31 +0000
@@ -257,7 +257,8 @@
dev.intl = dev.build('intl/')
dev.miniupnpc = dev.build('miniupnpc/')
dev.natpmp = dev.build('natpmp/')
-dev.dwt = dev.build('dwt/')
+dev.dwt = dev.build('dwt/src/')
+dev.dwt_test = dev.build('dwt/test/')
dev.client = dev.build('dcpp/')
dev.help = dev.build('help/')
dev.test = dev.build('test/')
=== modified file 'build_util.py'
--- build_util.py 2011-11-07 20:53:49 +0000
+++ build_util.py 2012-01-08 12:00:31 +0000
@@ -1,6 +1,7 @@
import glob
import sys
import os
+import fnmatch
class Dev:
def __init__(self, env):
@@ -103,8 +104,14 @@
else:
return self.get_build_root() + source_path + name
- def get_sources(self, source_path, source_glob):
- return map(lambda x: self.get_build_path(source_path) + x, glob.glob(source_glob))
+ def get_sources(self, source_path, source_glob, recursive = False):
+ matches = []
+ for root, dirnames, filenames in os.walk('.'):
+ for filename in fnmatch.filter(filenames, source_glob):
+ matches.append(os.path.join(root, filename))
+ if not recursive:
+ dirnames[:] = []
+ return map(lambda x: self.get_build_path(source_path) + x, matches)
# execute the SConscript file in the specified sub-directory.
def build(self, source_path, local_env = None):
@@ -114,12 +121,12 @@
return local_env.SConscript(source_path + 'SConscript', exports = { 'dev': self, 'source_path': full_path })
# create a build environment and set up sources and targets.
- def prepare_build(self, source_path, name, source_glob = '*.cpp', in_bin = True, precompiled_header = None):
+ def prepare_build(self, source_path, name, source_glob = '*.cpp', in_bin = True, precompiled_header = None, recursive = False):
build_path = self.get_build_path(source_path)
env = self.env.Clone()
env.VariantDir(build_path, '.', duplicate = 0)
- sources = self.get_sources(source_path, source_glob)
+ sources = self.get_sources(source_path, source_glob, recursive)
if precompiled_header is not None and env['pch'] and not env['msvcproj']:
for i, source in enumerate(sources):
=== removed file 'dwt/SConscript'
--- dwt/SConscript 2008-04-03 20:54:10 +0000
+++ dwt/SConscript 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-# vim: set filetype=py
-
-Import('dev source_path')
-
-ret = dev.build('src/')
-
-Return('ret')
=== modified file 'dwt/src/SConscript'
--- dwt/src/SConscript 2011-11-07 20:53:49 +0000
+++ dwt/src/SConscript 2012-01-08 12:00:31 +0000
@@ -1,6 +1,6 @@
Import('dev source_path')
-env, target, sources = dev.prepare_build(source_path, 'dwt', in_bin = False)
+env, target, sources = dev.prepare_build(source_path, 'dwt', in_bin = False, recursive=True)
env.Append(CPPPATH = ['#/dwt/include'])
@@ -14,7 +14,6 @@
return (parse_patterns(['*.h', 'include/dwt/*.h', 'include/dwt/*/*.h', 'include/dwt/*/*/*.h']),
parse_patterns(['*.cpp', 'src/*.cpp', 'src/*/*.cpp', 'src/*/*/*.cpp']))
-ret = [dev.build('util/'), dev.build('widgets/')]
+ret = dev.build_lib(env, target, sources, get_msvcproj_files, 'dwt')
-ret.append(dev.build_lib(env, target, [sources, ret], get_msvcproj_files, 'dwt'))
Return('ret')
=== added directory 'dwt/test'
=== added file 'dwt/test/SConscript'
--- dwt/test/SConscript 1970-01-01 00:00:00 +0000
+++ dwt/test/SConscript 2012-01-08 12:00:31 +0000
@@ -0,0 +1,21 @@
+# vim: set filetype=py
+
+Import('dev source_path')
+
+env = dev.env.Clone()
+
+env.Append(LIBS = ['comctl32', 'ws2_32', 'ole32', 'gdi32', 'comdlg32', 'iphlpapi', 'winmm', 'shlwapi', 'oleaut32', 'uuid', 'uxtheme'])
+
+env.Append(CPPPATH = ['#/dwt/include'])
+
+# imitate build_util's prepare_build
+env.VariantDir(dev.get_build_path(source_path), '.', duplicate = 0)
+import os
+ret = []
+for f in Glob('*.cpp'):
+ sources = dev.get_sources(source_path, str(f))
+ ret.append(env.Program(dev.get_target(source_path, os.path.basename(str(f)).replace('.cpp', ''), in_bin = False), [sources, dev.dwt, dev.dwarf, dev.boost, dev.bzip2, dev.intl]))
+
+env.Help("\nYou can build dwt tests by running 'scons dwt/test'\n")
+
+Return('ret')
=== added file 'dwt/test/TableTest.cpp'
--- dwt/test/TableTest.cpp 1970-01-01 00:00:00 +0000
+++ dwt/test/TableTest.cpp 2012-01-08 12:00:31 +0000
@@ -0,0 +1,30 @@
+#include <dwt/widgets/Window.h>
+#include <dwt/widgets/Table.h>
+#include <dwt/Texts.h>
+
+namespace dwt {
+tstring Texts::get(Text text) { return _T("test"); }
+}
+
+using dwt::tstring;
+
+int dwtMain(dwt::Application& app)
+{
+ auto window = new dwt::Window();
+ window->create();
+ window->onClosing([] { return ::PostQuitMessage(0), true; });
+
+ auto table = window->addChild(dwt::Table::Seed());
+
+ std::vector<tstring> columns;
+ columns.push_back(_T("A"));
+ columns.push_back(_T("B"));
+ table->createColumns(columns);
+ table->insert(columns);
+
+ table->resize(dwt::Rectangle(window->getClientSize()));
+
+ app.run();
+
+ return 0;
+}
=== modified file 'utils/SConscript'
--- utils/SConscript 2012-01-08 10:19:19 +0000
+++ utils/SConscript 2012-01-08 12:00:31 +0000
@@ -43,6 +43,6 @@
sources = dev.get_sources(source_path, str(f))
ret.append(env.Program(dev.get_target(source_path, os.path.basename(str(f)).replace('.cpp', ''), in_bin = False), [sources, dev.client, dev.dwarf, dev.zlib, dev.boost, dev.bzip2, dev.geoip, dev.miniupnpc, dev.natpmp, dev.intl]))
-env.Help("\nYou can build addition utilities by running 'scons utils'\n")
+env.Help("\nYou can build additional utilities by running 'scons utils'\n")
Return('ret')