|
From: <fli...@li...> - 2026-07-27 10:06:25
|
unknown user pushed a commit to branch next
in repository simgear.
The following commit(s) were added to refs/heads/next by this push:
new 13363ac5 Refactoring: Replace boost library dependency by reimplementation
13363ac5 is described below
SF URL: http://sourceforge.net/p/flightgear/simgear/ci/13363ac5052ee70edab99a17d4135335409eff80/
Commit: 13363ac5052ee70edab99a17d4135335409eff80
Author: Thorsten Hackbarth
Committer: James Turner
AuthorDate: Mon Jul 27 11:18:36 2026 +0200
Refactoring: Replace boost library dependency by reimplementation
---
.gitlab-ci.yml | 3 +-
CMakeLists.txt | 9 +-
CMakeModules/BoostTestTargets.cmake | 260 ----------
CMakeModules/BoostTestTargetsDynamic.h | 13 -
CMakeModules/BoostTestTargetsIncluded.h | 7 -
CMakeModules/BoostTestTargetsStatic.h | 7 -
CMakeModules/ConfigureMsvc3rdParty.cmake | 22 -
simgear/CMakeLists.txt | 3 -
simgear/canvas/elements/CMakeLists.txt | 5 +-
simgear/canvas/elements/canvas_element_test.cpp | 39 +-
simgear/canvas/events/CMakeLists.txt | 5 +-
simgear/canvas/events/KeyboardEvent.cxx | 18 +-
simgear/canvas/events/event_test.cpp | 48 +-
simgear/canvas/layout/CMakeLists.txt | 5 +-
simgear/canvas/layout/canvas_layout_test.cxx | 535 +++++++++++----------
.../embedded_resources/embedded_resources_test.cxx | 48 +-
simgear/emesary/CMakeLists.txt | 2 +
simgear/misc/CMakeLists.txt | 15 +-
simgear/misc/CSSBorder.cxx | 48 +-
simgear/misc/SVGpreserveAspectRatio.cxx | 18 +-
simgear/misc/SVGpreserveAspectRatio_test.cxx | 77 ++-
simgear/misc/argparse_test.cxx | 10 +-
simgear/misc/hash_utils.hxx | 42 ++
simgear/misc/hash_utils_test.cxx | 133 +++++
simgear/misc/lru_cache.hxx | 21 +-
simgear/misc/strutils.cxx | 15 +-
simgear/misc/strutils.hxx | 1 +
simgear/misc/strutils_test.cxx | 69 +--
simgear/misc/test_macros.hxx | 38 ++
simgear/misc/type_utils.hxx | 20 +
simgear/misc/type_utils_test.cxx | 56 +++
simgear/misc/utf8tolatin1_test.cxx | 28 +-
simgear/nasal/cppbind/CMakeLists.txt | 23 +-
simgear/nasal/cppbind/Ghost.hxx | 39 +-
simgear/nasal/cppbind/NasalContext.hxx | 20 +-
simgear/nasal/cppbind/NasalHash.hxx | 116 +++--
simgear/nasal/cppbind/detail/to_nasal_helper.hxx | 4 +-
simgear/nasal/cppbind/test/TestContext.hxx | 9 +-
simgear/nasal/cppbind/test/cppbind_test.cxx | 342 ++++++-------
simgear/nasal/cppbind/test/cppbind_test_ghost.cxx | 166 ++++---
simgear/nasal/cppbind/test/nasal_gc_test.cxx | 100 ++--
simgear/nasal/cppbind/test/nasal_num_test.cxx | 89 ++--
simgear/nasal/cppbind/to_nasal.hxx | 12 +-
simgear/package/CatalogTest.cxx | 7 +-
simgear/props/propertyObject_test.cxx | 16 +-
simgear/props/props.cxx | 323 +++++++------
simgear/props/props.hxx | 1 -
simgear/scene/material/Effect.cxx | 33 +-
simgear/scene/material/Effect.hxx | 11 +-
simgear/scene/material/EffectBuilder.hxx | 142 ++++--
simgear/scene/material/EffectGeode.hxx | 85 ++--
simgear/scene/material/Technique.cxx | 22 +-
simgear/scene/model/ModelRegistry.cxx | 4 +-
simgear/scene/model/SGPickAnimation.cxx | 2 +-
simgear/scene/model/modellib.cxx | 9 +-
simgear/scene/tgdb/SGTileDetailsCallback.hxx | 26 +-
simgear/scene/util/OsgSingleton.hxx | 8 +-
simgear/structure/CMakeLists.txt | 6 +-
simgear/structure/Singleton.hxx | 6 +-
simgear/structure/StringTable.hxx | 15 +-
simgear/structure/function_list_test.cxx | 39 +-
simgear/structure/singleton.hpp | 102 ----
simgear/structure/subsystem_test.cxx | 8 +-
63 files changed, 1621 insertions(+), 1784 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fb026dfc..891ce06d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -197,7 +197,6 @@ windows-build:
# relocate our upstream deps outside the source dir, otherwise
# CMake gets sad.
- - Move-Item -Path $CI_PROJECT_DIR\boost $WIN_FG_DIR\boost
- Move-Item -Path $CI_PROJECT_DIR\msvc140 $WIN_FG_DIR\msvc140
# This is for ccache.exe.
- $Env:PATH += ";$CI_PROJECT_DIR"
@@ -243,7 +242,7 @@ macos-build:
before_script:
- export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
- export HOMEBREW_NO_INSTALL_CLEANUP=1
- - brew install ninja cmake boost c-ares ccache
+ - brew install ninja cmake c-ares ccache
- !reference [.ccache-pre_non-windows, before_script]
script:
- >
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00ec241a..215dbb2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,9 +143,8 @@ endif()
find_package(Threads REQUIRED)
-find_package(Boost REQUIRED)
-set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG -DBOOST_NO_AUTO_PTR -DBOOST_NO_CXX98_BINDERS")
-include(BoostTestTargets)
+include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+
set(SG_SOUND_USES_OPENALSOFT OFF) # default to off
@@ -190,6 +189,7 @@ else()
include(CreateOSGImportedTargets)
endif(SIMGEAR_HEADLESS)
+if(NOT SIMGEAR_HEADLESS)
# Ensure that we are using the right version of OSG
# This should probably be done by modifying FindOpenSceneGraph.cmake, but this
# is easier/faster and only requires minimal changes to OSG.
@@ -237,6 +237,7 @@ if (NOT SIMGEAR_OSG_CORRECT_VERSION)
"Please ensure that you are using the correct branch of the OSG fork."
)
endif()
+endif(NOT SIMGEAR_HEADLESS)
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
# As of 2020-08-01, OpenBSD's system zlib is slightly old, but it's usable
@@ -444,7 +445,7 @@ endif()
# TODO: should this be special-cased for multi-config as well?
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
include(CheckCXXFeatures)
diff --git a/CMakeModules/BoostTestTargets.cmake b/CMakeModules/BoostTestTargets.cmake
deleted file mode 100644
index 54f6d6fa..00000000
--- a/CMakeModules/BoostTestTargets.cmake
+++ /dev/null
@@ -1,260 +0,0 @@
-# SPDX-License-Identifier: BSL-1.0
-# SPDX-FileCopyrightText: 2009-2010 Iowa State University
-
-# - Add tests using boost::test
-#
-# Add this line to your test files in place of including a basic boost test header:
-# #include <BoostTestTargetConfig.h>
-#
-# If you cannot do that and must use the included form for a given test,
-# include the line
-# // OVERRIDE_BOOST_TEST_INCLUDED_WARNING
-# in the same file with the boost test include.
-#
-# include(BoostTestTargets)
-# add_boost_test(<testdriver_name> SOURCES <source1> [<more sources...>]
-# [FAIL_REGULAR_EXPRESSION <additional fail regex>]
-# [LAUNCHER <generic launcher script>]
-# [LIBRARIES <library> [<library>...]]
-# [RESOURCES <resource> [<resource>...]]
-# [TESTS <testcasename> [<testcasename>...]])
-#
-# If for some reason you need access to the executable target created,
-# it can be found in ${${testdriver_name}_TARGET_NAME} as specified when
-# you called add_boost_test
-#
-# Requires CMake 2.6 or newer (uses the 'function' command)
-#
-# Requires:
-# GetForceIncludeDefinitions
-# CopyResourcesToBuildTree
-#
-# Original Author:
-# 2009-2010 Ryan Pavlik <rp...@ia...> <ab...@ry...>
-# http://academic.cleardefinition.com
-# Iowa State University HCI Graduate Program/VRAC
-
-if(__add_boost_test)
- return()
-endif()
-set(__add_boost_test YES)
-
-set(BOOST_TEST_TARGET_PREFIX "test")
-
-if(NOT Boost_FOUND)
- find_package(Boost 1.34.0 QUIET)
-endif()
-
-if (NOT Boost_VERSION_MACRO)
- # Compatibility with pre CMP0093 (CMake 3.15)
- set(Boost_VERSION_MACRO ${Boost_VERSION})
-endif()
-
-if("${Boost_VERSION_MACRO}0" LESS "1034000")
- set(_shared_msg
- "NOTE: boost::test-based targets and tests cannot "
- "be added: boost >= 1.34.0 required but not found. "
- "(found: '${Boost_VERSION_MACRO}'; want >=103400) ")
- if(ENABLE_TESTS)
- message(FATAL_ERROR
- ${_shared_msg}
- "You may disable ENABLE_TESTS to continue without the "
- "tests.")
- else()
- message(STATUS
- ${_shared_msg}
- "ENABLE_TESTS disabled, so continuing anyway.")
- endif()
-endif()
-
-include(GetForceIncludeDefinitions)
-include(CopyResourcesToBuildTree)
-
-if(Boost_FOUND AND NOT "${Boost_VERSION_MACRO}0" LESS "1034000")
- set(_boosttesttargets_libs)
- set(_boostConfig "BoostTestTargetsIncluded.h")
- if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
- find_package(Boost 1.34.0 QUIET COMPONENTS unit_test_framework)
- endif()
- if(Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
- set(_boosttesttargets_libs "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
- if(Boost_USE_STATIC_LIBS)
- set(_boostConfig "BoostTestTargetsStatic.h")
- else()
- set(_boostConfig "BoostTestTargetsDynamic.h")
- endif()
- endif()
- get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} DIRECTORY)
- configure_file("${_moddir}/${_boostConfig}"
- "${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h"
- COPYONLY)
- include_directories("${CMAKE_CURRENT_BINARY_DIR}")
-endif()
-
-function(add_boost_test _name)
- if(NOT ENABLE_TESTS)
- return()
- endif()
-
- # parse arguments
- set(_nowhere)
- set(_curdest _nowhere)
- set(_val_args
- SOURCES
- FAIL_REGULAR_EXPRESSION
- LAUNCHER
- LIBRARIES
- RESOURCES
- TESTS)
- set(_bool_args
- USE_COMPILED_LIBRARY)
- foreach(_arg ${_val_args} ${_bool_args})
- set(${_arg})
- endforeach()
- foreach(_element ${ARGN})
- list(FIND _val_args "${_element}" _val_arg_find)
- list(FIND _bool_args "${_element}" _bool_arg_find)
- if("${_val_arg_find}" GREATER "-1")
- set(_curdest "${_element}")
- elseif("${_bool_arg_find}" GREATER "-1")
- set("${_element}" ON)
- set(_curdest _nowhere)
- else()
- list(APPEND ${_curdest} "${_element}")
- endif()
- endforeach()
-
- if(_nowhere)
- message(FATAL_ERROR "Syntax error in use of add_boost_test!")
- endif()
-
- if(NOT SOURCES)
- message(FATAL_ERROR
- "Syntax error in use of add_boost_test: at least one source file required!")
- endif()
-
- if(Boost_FOUND AND NOT "${Boost_VERSION_MACRO}0" LESS "1034000")
-
- include_directories(${Boost_INCLUDE_DIRS})
-
- set(includeType)
- foreach(src ${SOURCES})
- file(READ ${src} thefile)
- if("${thefile}" MATCHES ".*BoostTestTargetConfig.h.*")
- set(includeType CONFIGURED)
- set(includeFileLoc ${src})
- break()
- elseif("${thefile}" MATCHES ".*boost/test/included/unit_test.hpp.*")
- set(includeType INCLUDED)
- set(includeFileLoc ${src})
- set(_boosttesttargets_libs) # clear this out - linking would be a bad idea
- if(NOT
- "${thefile}"
- MATCHES
- ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*")
- message("Please replace the include line in ${src} with this alternate include line instead:")
- message(" \#include <BoostTestTargetConfig.h>")
- message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)")
- endif()
- break()
- endif()
- endforeach()
-
- if(NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType}")
- if("${includeType}" STREQUAL "CONFIGURED")
- message(STATUS
- "Test '${_name}' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc})")
- elseif("${includeType}" STREQUAL "INCLUDED")
- message("In test '${_name}': ${includeFileLoc} uses the 'included' form of the boost unit test framework.")
- else()
- message("In test '${_name}': Didn't detect the CMake-configurable boost test include.")
- message("Please replace your existing boost test include in that test with the following:")
- message(" \#include <BoostTestTargetConfig.h>")
- message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)")
- endif()
- endif()
- set(_boostTestTargetsNagged${_name}
- "${includeType}"
- CACHE
- INTERNAL
- ""
- FORCE)
-
-
- if(RESOURCES)
- list(APPEND SOURCES ${RESOURCES})
- endif()
-
- # Generate a unique target name, using the relative binary dir
- # and provided name. (transform all / into _ and remove all other
- # non-alphabet characters)
- file(RELATIVE_PATH
- targetpath
- "${CMAKE_BINARY_DIR}"
- "${CMAKE_CURRENT_BINARY_DIR}")
- string(REGEX REPLACE "[^A-Za-z/_]" "" targetpath "${targetpath}")
- string(REPLACE "/" "_" targetpath "${targetpath}")
-
- set(_target_name ${BOOST_TEST_TARGET_PREFIX}-${targetpath}-${_name})
- set(${_name}_TARGET_NAME "${_target_name}" PARENT_SCOPE)
-
- # Build the test.
- add_executable(${_target_name} ${SOURCES})
-
- list(APPEND LIBRARIES ${_boosttesttargets_libs})
-
- if(LIBRARIES)
- target_link_libraries(${_target_name} ${LIBRARIES})
- endif()
-
- if(RESOURCES)
- set_property(TARGET ${_target_name} PROPERTY RESOURCE ${RESOURCES})
- copy_resources_to_build_tree(${_target_name})
- endif()
-
- if(NOT Boost_TEST_FLAGS)
-# set(Boost_TEST_FLAGS --catch_system_error=yes --output_format=XML)
- set(Boost_TEST_FLAGS --catch_system_error=yes)
- endif()
-
- # TODO: Figure out why only recent boost handles individual test running properly
-
- if(LAUNCHER)
- set(_test_command ${LAUNCHER} "\$<TARGET_FILE:${_target_name}>")
- else()
- set(_test_command ${_target_name})
- endif()
-
- if(TESTS AND ( "${Boost_VERSION_MACRO}" VERSION_GREATER "103799" ))
- foreach(_test ${TESTS})
- add_test(
- ${_name}-${_test}
- ${_test_command} --run_test=${_test} ${Boost_TEST_FLAGS}
- )
- if(FAIL_REGULAR_EXPRESSION)
- set_tests_properties(${_name}-${_test}
- PROPERTIES
- FAIL_REGULAR_EXPRESSION
- "${FAIL_REGULAR_EXPRESSION}")
- endif()
- endforeach()
- else()
- add_test(
- ${_name}-boost_test
- ${_test_command} ${Boost_TEST_FLAGS}
- )
- if(FAIL_REGULAR_EXPRESSION)
- set_tests_properties(${_name}-boost_test
- PROPERTIES
- FAIL_REGULAR_EXPRESSION
- "${FAIL_REGULAR_EXPRESSION}")
- endif()
- endif()
-
- # CppCheck the test if we can.
- if(COMMAND add_cppcheck)
- add_cppcheck(${_target_name} STYLE UNUSED_FUNCTIONS)
- endif()
-
- endif()
-endfunction()
diff --git a/CMakeModules/BoostTestTargetsDynamic.h b/CMakeModules/BoostTestTargetsDynamic.h
deleted file mode 100644
index fd28cf91..00000000
--- a/CMakeModules/BoostTestTargetsDynamic.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: LGPL-2.1-or-later
-// SPDX-FileCopyrightText: 2014 Thomas Geymayer
-
-// Small header computed by CMake to set up boost test.
-// include AFTER #define BOOST_TEST_MODULE whatever
-// but before any other boost test includes.
-
-// Using the Boost UTF dynamic library
-
-#ifndef BOOST_TEST_DYN_LINK
- #define BOOST_TEST_DYN_LINK
-#endif
-#include <boost/test/unit_test.hpp>
diff --git a/CMakeModules/BoostTestTargetsIncluded.h b/CMakeModules/BoostTestTargetsIncluded.h
deleted file mode 100644
index 253133ce..00000000
--- a/CMakeModules/BoostTestTargetsIncluded.h
+++ /dev/null
@@ -1,7 +0,0 @@
-// Small header computed by CMake to set up boost test.
-// include AFTER #define BOOST_TEST_MODULE whatever
-// but before any other boost test includes.
-
-// Using the Boost UTF included framework
-
-#include <boost/test/included/unit_test.hpp>
diff --git a/CMakeModules/BoostTestTargetsStatic.h b/CMakeModules/BoostTestTargetsStatic.h
deleted file mode 100644
index dd3cddae..00000000
--- a/CMakeModules/BoostTestTargetsStatic.h
+++ /dev/null
@@ -1,7 +0,0 @@
-// Small header computed by CMake to set up boost test.
-// include AFTER #define BOOST_TEST_MODULE whatever
-// but before any other boost test includes.
-
-// Using the Boost UTF static library
-
-#include <boost/test/unit_test.hpp>
diff --git a/CMakeModules/ConfigureMsvc3rdParty.cmake b/CMakeModules/ConfigureMsvc3rdParty.cmake
index 8d5e7b1c..334222ad 100644
--- a/CMakeModules/ConfigureMsvc3rdParty.cmake
+++ b/CMakeModules/ConfigureMsvc3rdParty.cmake
@@ -13,14 +13,12 @@
# - path to an architecture specific subdir, eg -DMSVC_3RDPARTY_ROOT=C:\FGFS\windows-3rd-party\msvc140\3rdparty.x64
set(_FOUND_3RDPARTY_DIR "NOTFOUND")
-set(_FOUND_BOOST_INCLUDE_DIR "NOTFOUND")
# try various suffixes of a base directory, and
# set the variables above on success
function(_check_candidate_msvc_path pathToCheck)
unset (_freeTypeHeader CACHE )
unset (_zlibDll CACHE )
- unset (_boostHeaders CACHE )
find_path(_freeTypeHeader include/ft2build.h
PATHS
@@ -42,18 +40,9 @@ function(_check_candidate_msvc_path pathToCheck)
NO_DEFAULT_PATH
)
- find_path(_boostHeaders boost/atomic.hpp
- PATHS
- ${pathToCheck}
- NO_DEFAULT_PATH
- )
-
if (_freeTypeHeader AND _zlibDll)
set(_FOUND_3RDPARTY_DIR "${_freeTypeHeader}" PARENT_SCOPE)
- if (_boostHeaders)
- set(_FOUND_BOOST_INCLUDE_DIR "${_boostHeaders}" PARENT_SCOPE)
- endif()
endif()
endfunction()
@@ -121,15 +110,4 @@ if (MSVC AND _FOUND_3RDPARTY_DIR)
message(STATUS "3rdparty files located in ${_FOUND_3RDPARTY_DIR}")
list(APPEND CMAKE_PREFIX_PATH ${_FOUND_3RDPARTY_DIR})
set(FINAL_MSVC_3RDPARTY_DIR ${_FOUND_3RDPARTY_DIR})
-
- if (CMAKE_CL_64)
- set( BOOST_LIB lib64 )
- else (CMAKE_CL_64)
- set( BOOST_LIB lib )
- endif (CMAKE_CL_64)
-
- if(NOT BOOST_INCLUDEDIR AND _FOUND_BOOST_INCLUDE_DIR)
- set(BOOST_INCLUDEDIR ${_FOUND_BOOST_INCLUDE_DIR})
- message(STATUS "found Boost headers at ${_FOUND_BOOST_INCLUDE_DIR}")
- endif()
endif ()
diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt
index c24938f3..1da1ece6 100644
--- a/simgear/CMakeLists.txt
+++ b/simgear/CMakeLists.txt
@@ -76,9 +76,6 @@ target_include_directories(SimGearCore PRIVATE ${PROJECT_BINARY_DIR}/simgear)
target_include_directories(SimGearCore INTERFACE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>)
-target_include_directories(SimGearCore PUBLIC
- ${Boost_INCLUDE_DIRS})
-
if (MSVC)
message(WARNING "FIXME: setting _HAS_STD_BYTE=0 for SimGear build, this needs to be fixed.")
target_compile_definitions(SimGearCore PRIVATE _HAS_STD_BYTE=0)
diff --git a/simgear/canvas/elements/CMakeLists.txt b/simgear/canvas/elements/CMakeLists.txt
index 4be0545a..a3cee9ae 100644
--- a/simgear/canvas/elements/CMakeLists.txt
+++ b/simgear/canvas/elements/CMakeLists.txt
@@ -22,7 +22,4 @@ if (TARGET SimGearScene)
install(FILES ${HEADERS} DESTINATION include/simgear/canvas/elements)
endif()
-add_boost_test(canvas_element
- SOURCES canvas_element_test.cpp
- LIBRARIES SimGearScene
-)
+add_simgear_scene_autotest(canvas_element canvas_element_test.cpp)
diff --git a/simgear/canvas/elements/canvas_element_test.cpp b/simgear/canvas/elements/canvas_element_test.cpp
index ce3216b3..efc9cd1f 100644
--- a/simgear/canvas/elements/canvas_element_test.cpp
+++ b/simgear/canvas/elements/canvas_element_test.cpp
@@ -1,20 +1,19 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
+// SPDX-FileCopyrightText: 2014 Thomas Geymayer <to...@gm...>
/// Unit tests for canvas::Element
-#define BOOST_TEST_MODULE canvas
-#include <BoostTestTargetConfig.h>
-
#include "CanvasElement.hxx"
#include "CanvasGroup.hxx"
+#include <simgear/misc/test_macros.hxx>
namespace sc = simgear::canvas;
-BOOST_AUTO_TEST_CASE( attr_data )
+void test_attr_data()
{
// http://www.w3.org/TR/html5/dom.html#attr-data-*
-#define SG_CHECK_ATTR2PROP(attr, prop)\
- BOOST_CHECK_EQUAL(sc::Element::attrToDataPropName(attr), prop)
+#define SG_CHECK_ATTR2PROP(attr, prop) \
+ SG_CHECK_EQUAL(sc::Element::attrToDataPropName(attr), std::string(prop))
// If name starts with "data-", for each "-" (U+002D) character in the name
// that is followed by a lowercase ASCII letter, remove the "-" (U+002D)
@@ -28,8 +27,8 @@ BOOST_AUTO_TEST_CASE( attr_data )
#undef SG_CHECK_ATTR2PROP
-#define SG_CHECK_PROP2ATTR(prop, attr)\
- BOOST_CHECK_EQUAL(sc::Element::dataPropToAttrName(prop), attr)
+#define SG_CHECK_PROP2ATTR(prop, attr) \
+ SG_CHECK_EQUAL(sc::Element::dataPropToAttrName(prop), std::string(attr))
// If name contains a "-" (U+002D) character followed by a lowercase ASCII
// letter, throw a SyntaxError exception (empty string) and abort these steps.
@@ -51,18 +50,24 @@ BOOST_AUTO_TEST_CASE( attr_data )
sc::Element::create<sc::Group>(sc::CanvasWeakPtr(), node);
el->setDataProp("myData", 3);
- BOOST_CHECK_EQUAL( el->getDataProp<int>("myData"), 3 );
- BOOST_CHECK_EQUAL( node->getIntValue("data-my-data"), 3 );
+ SG_CHECK_EQUAL(el->getDataProp<int>("myData"), 3);
+ SG_CHECK_EQUAL(node->getIntValue("data-my-data"), 3);
SGPropertyNode* prop = el->getDataProp<SGPropertyNode*>("notExistingProp");
- BOOST_CHECK( !prop );
+ SG_VERIFY(!prop);
prop = el->getDataProp<SGPropertyNode*>("myData");
- BOOST_CHECK( prop );
- BOOST_CHECK_EQUAL( prop->getParent(), node );
- BOOST_CHECK_EQUAL( prop->getIntValue(), 3 );
+ SG_VERIFY(prop);
+ SG_CHECK_EQUAL(prop->getParent(), node);
+ SG_CHECK_EQUAL(prop->getIntValue(), 3);
- BOOST_CHECK( el->hasDataProp("myData") );
+ SG_VERIFY(el->hasDataProp("myData"));
el->removeDataProp("myData");
- BOOST_CHECK( !el->hasDataProp("myData") );
- BOOST_CHECK_EQUAL( el->getDataProp("myData", 5), 5 );
+ SG_VERIFY(!el->hasDataProp("myData"));
+ SG_CHECK_EQUAL(el->getDataProp("myData", 5), 5);
+}
+
+int main()
+{
+ test_attr_data();
+ return 0;
}
diff --git a/simgear/canvas/events/CMakeLists.txt b/simgear/canvas/events/CMakeLists.txt
index 32519fa6..87e8716f 100644
--- a/simgear/canvas/events/CMakeLists.txt
+++ b/simgear/canvas/events/CMakeLists.txt
@@ -20,10 +20,7 @@ if (TARGET SimGearScene)
install(FILES ${HEADERS} DESTINATION include/simgear/canvas/events)
endif()
-add_boost_test(canvas_event
- SOURCES event_test.cpp
- LIBRARIES SimGearScene
-)
+add_simgear_scene_autotest(canvas_event event_test.cpp)
add_simgear_test(input_event_demo input_event_demo.cxx)
target_link_libraries(input_event_demo
diff --git a/simgear/canvas/events/KeyboardEvent.cxx b/simgear/canvas/events/KeyboardEvent.cxx
index 9b6cf3ed..85c32a69 100644
--- a/simgear/canvas/events/KeyboardEvent.cxx
+++ b/simgear/canvas/events/KeyboardEvent.cxx
@@ -12,14 +12,8 @@
#include <osgGA/GUIEventAdapter>
-#include <boost/version.hpp>
-#if BOOST_VERSION >= 104800
-# include <boost/container/flat_map.hpp>
-# include <boost/container/flat_set.hpp>
-#else
-# include <map>
-# include <set>
-#endif
+#include <map>
+#include <set>
#include <iterator>
@@ -31,7 +25,7 @@ namespace canvas
// TODO check Win/Mac keycode for altgr/ISO Level3 Shift
const uint32_t KEY_AltGraph = 0xfe03;
-
+
//----------------------------------------------------------------------------
KeyboardEvent::KeyboardEvent():
@@ -99,14 +93,8 @@ namespace canvas
// system.
typedef std::pair<const char*, uint8_t> InternalKeyInfo;
-#if BOOST_VERSION >= 104800
- typedef boost::container::flat_map<int, InternalKeyInfo> InternalKeyMap;
- typedef boost::container::flat_set<int> KeyList;
-#else
-# warning "Use Boost >= 1.48 for faster and more memory efficient key lookup"
typedef std::map<int, InternalKeyInfo> InternalKeyMap;
typedef std::set<int> KeyList;
-#endif
static InternalKeyMap key_map;
static KeyList num_pad_keys;
diff --git a/simgear/canvas/events/event_test.cpp b/simgear/canvas/events/event_test.cpp
index 8cdb9687..6a692bd3 100644
--- a/simgear/canvas/events/event_test.cpp
+++ b/simgear/canvas/events/event_test.cpp
@@ -1,38 +1,42 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
+// SPDX-FileCopyrightText: 2014 Thomas Geymayer <to...@gm...>
-/// Unit tests for reference counting and smart pointer classes
-#define BOOST_TEST_MODULE structure
-#include <BoostTestTargetConfig.h>
-
-#include "MouseEvent.hxx"
#include "CustomEvent.hxx"
+#include "MouseEvent.hxx"
+#include <simgear/misc/test_macros.hxx>
namespace sc = simgear::canvas;
-BOOST_AUTO_TEST_CASE( canvas_event_types )
+void test_canvas_event_types()
{
// Register type
- BOOST_REQUIRE_EQUAL( sc::Event::strToType("test"),
- sc::Event::UNKNOWN );
- BOOST_REQUIRE_EQUAL( sc::Event::getOrRegisterType("test"),
- sc::Event::CUSTOM_EVENT );
- BOOST_REQUIRE_EQUAL( sc::Event::strToType("test"),
- sc::Event::CUSTOM_EVENT );
- BOOST_REQUIRE_EQUAL( sc::Event::typeToStr(sc::Event::CUSTOM_EVENT),
- "test" );
+ SG_CHECK_EQUAL_NOSTREAM(sc::Event::strToType("test"),
+ sc::Event::UNKNOWN);
+ SG_CHECK_EQUAL_NOSTREAM(sc::Event::getOrRegisterType("test"),
+ sc::Event::CUSTOM_EVENT);
+ SG_CHECK_EQUAL_NOSTREAM(sc::Event::strToType("test"),
+ sc::Event::CUSTOM_EVENT);
+ SG_CHECK_EQUAL(sc::Event::typeToStr(sc::Event::CUSTOM_EVENT),
+ std::string("test"));
// Basic internal type
- BOOST_REQUIRE_EQUAL( sc::Event::typeToStr(sc::Event::MOUSE_DOWN),
- "mousedown" );
- BOOST_REQUIRE_EQUAL( sc::Event::strToType("mousedown"),
- sc::Event::MOUSE_DOWN );
+ SG_CHECK_EQUAL(sc::Event::typeToStr(sc::Event::MOUSE_DOWN),
+ std::string("mousedown"));
+ SG_CHECK_EQUAL_NOSTREAM(sc::Event::strToType("mousedown"),
+ sc::Event::MOUSE_DOWN);
// Unknown type
- BOOST_REQUIRE_EQUAL( sc::Event::typeToStr(123),
- "unknown" );
+ SG_CHECK_EQUAL(sc::Event::typeToStr(123),
+ std::string("unknown"));
// Register type through custom event instance
sc::CustomEvent e("blub");
- BOOST_REQUIRE_EQUAL( e.getTypeString(), "blub" );
- BOOST_REQUIRE_NE( e.getType(), sc::Event::UNKNOWN );
+ SG_CHECK_EQUAL(e.getTypeString(), std::string("blub"));
+ SG_CHECK_NE_NOSTREAM(e.getType(), sc::Event::UNKNOWN);
+}
+
+int main()
+{
+ test_canvas_event_types();
+ return 0;
}
diff --git a/simgear/canvas/layout/CMakeLists.txt b/simgear/canvas/layout/CMakeLists.txt
index e9f29424..fdaede68 100644
--- a/simgear/canvas/layout/CMakeLists.txt
+++ b/simgear/canvas/layout/CMakeLists.txt
@@ -25,7 +25,4 @@ if (TARGET SimGearScene)
install(FILES ${HEADERS} DESTINATION include/simgear/canvas/layout)
endif()
-add_boost_test(canvas_layout
- SOURCES canvas_layout_test.cxx
- LIBRARIES SimGearScene
-)
+add_simgear_scene_autotest(canvas_layout canvas_layout_test.cxx)
diff --git a/simgear/canvas/layout/canvas_layout_test.cxx b/simgear/canvas/layout/canvas_layout_test.cxx
index 5e64bd31..e1420f0a 100644
--- a/simgear/canvas/layout/canvas_layout_test.cxx
+++ b/simgear/canvas/layout/canvas_layout_test.cxx
@@ -6,28 +6,16 @@
* @brief Testing canvas layout system
*/
-#define BOOST_TEST_MODULE canvas_layout
-#include <BoostTestTargetConfig.h>
-
#include "BoxLayout.hxx"
#include "GridLayout.hxx"
#include "NasalWidget.hxx"
#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/test_macros.hxx>
#include <simgear/nasal/cppbind/NasalContext.hxx>
#include <cstdlib>
-//------------------------------------------------------------------------------
-struct SetLogLevelFixture
-{
- SetLogLevelFixture()
- {
- // sglog().set_log_priority(SG_DEBUG);
- }
-};
-BOOST_GLOBAL_FIXTURE(SetLogLevelFixture);
-
//------------------------------------------------------------------------------
namespace sc = simgear::canvas;
@@ -105,28 +93,28 @@ class TestWidgetHFW:
typedef SGSharedPtr<TestWidget> TestWidgetRef;
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( horizontal_layout )
+void test_horizontal_layout()
{
sc::BoxLayoutRef box_layout(new sc::BoxLayout(sc::BoxLayout::BottomToTop));
box_layout->setSpacing(5);
- BOOST_CHECK_EQUAL(box_layout->direction(), sc::BoxLayout::BottomToTop);
- BOOST_CHECK_EQUAL(box_layout->spacing(), 5);
+ SG_CHECK_EQUAL_NOSTREAM(box_layout->direction(), sc::BoxLayout::BottomToTop);
+ SG_CHECK_EQUAL(box_layout->spacing(), 5);
box_layout->setDirection(sc::BoxLayout::LeftToRight);
box_layout->setSpacing(9);
- BOOST_CHECK_EQUAL(box_layout->direction(), sc::BoxLayout::LeftToRight);
- BOOST_CHECK_EQUAL(box_layout->spacing(), 9);
+ SG_CHECK_EQUAL_NOSTREAM(box_layout->direction(), sc::BoxLayout::LeftToRight);
+ SG_CHECK_EQUAL(box_layout->spacing(), 9);
TestWidgetRef fixed_size_widget( new TestWidget( SGVec2i(16, 16),
SGVec2i(16, 16),
SGVec2i(16, 16) ) );
box_layout->addItem(fixed_size_widget);
- BOOST_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(16, 16));
- BOOST_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(16, 16));
- BOOST_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(16, 16));
+ SG_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(16, 16));
+ SG_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(16, 16));
+ SG_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(16, 16));
TestWidgetRef limited_resize_widget( new TestWidget( SGVec2i(16, 16),
SGVec2i(32, 32),
@@ -134,22 +122,22 @@ BOOST_AUTO_TEST_CASE( horizontal_layout )
box_layout->addItem(limited_resize_widget);
// Combined sizes of both widget plus the padding between them
- BOOST_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(41, 16));
- BOOST_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(57, 32));
- BOOST_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(281, 64));
+ SG_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(41, 16));
+ SG_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(57, 32));
+ SG_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(281, 64));
// Test with different spacing/padding
box_layout->setSpacing(5);
- BOOST_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(37, 16));
- BOOST_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(53, 32));
- BOOST_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(277, 64));
+ SG_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(37, 16));
+ SG_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(53, 32));
+ SG_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(277, 64));
box_layout->setGeometry(SGRecti(0, 0, 128, 32));
// Fixed size for first widget and remaining space goes to second widget
- BOOST_CHECK_EQUAL(fixed_size_widget->geometry(), SGRecti(0, 8, 16, 16));
- BOOST_CHECK_EQUAL(limited_resize_widget->geometry(), SGRecti(21, 0, 107, 32));
+ SG_CHECK_EQUAL(fixed_size_widget->geometry(), SGRecti(0, 8, 16, 16));
+ SG_CHECK_EQUAL(limited_resize_widget->geometry(), SGRecti(21, 0, 107, 32));
TestWidgetRef stretch_widget( new TestWidget( SGVec2i(16, 16),
SGVec2i(32, 32),
@@ -157,15 +145,15 @@ BOOST_AUTO_TEST_CASE( horizontal_layout )
box_layout->addItem(stretch_widget, 1);
box_layout->update();
- BOOST_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(58, 16));
- BOOST_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(90, 32));
- BOOST_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(410, 64));
+ SG_CHECK_EQUAL(box_layout->minimumSize(), SGVec2i(58, 16));
+ SG_CHECK_EQUAL(box_layout->sizeHint(), SGVec2i(90, 32));
+ SG_CHECK_EQUAL(box_layout->maximumSize(), SGVec2i(410, 64));
// Due to the stretch factor only the last widget gets additional space. All
// other widgets get the preferred size.
- BOOST_CHECK_EQUAL(fixed_size_widget->geometry(), SGRecti(0, 8, 16, 16));
- BOOST_CHECK_EQUAL(limited_resize_widget->geometry(), SGRecti(21, 0, 32, 32));
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(58, 0, 70, 32));
+ SG_CHECK_EQUAL(fixed_size_widget->geometry(), SGRecti(0, 8, 16, 16));
+ SG_CHECK_EQUAL(limited_resize_widget->geometry(), SGRecti(21, 0, 32, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(58, 0, 70, 32));
// Test stretch factor
TestWidgetRef fast_stretch( new TestWidget(*stretch_widget) );
@@ -178,19 +166,19 @@ BOOST_AUTO_TEST_CASE( horizontal_layout )
box_layout_stretch->setGeometry(SGRecti(0,0,128,32));
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 41, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(46, 0, 82, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 41, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(46, 0, 82, 32));
box_layout_stretch->setGeometry(SGRecti(0,0,256,32));
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 123, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(128, 0, 128, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 123, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(128, 0, 128, 32));
// Test superfluous space to padding
box_layout_stretch->setGeometry(SGRecti(0,0,512,32));
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(83, 0, 128, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(300, 0, 128, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(83, 0, 128, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(300, 0, 128, 32));
// ...and now with alignment
//
@@ -203,33 +191,33 @@ BOOST_AUTO_TEST_CASE( horizontal_layout )
// Right widget: maximum size and positioned on the right
stretch_widget->setAlignment(sc::AlignLeft);
box_layout_stretch->update();
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 32, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(384, 0, 128, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 32, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(384, 0, 128, 32));
// Left widget: align right
stretch_widget->setAlignment(sc::AlignRight);
box_layout_stretch->update();
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(347, 0, 32, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(384, 0, 128, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(347, 0, 32, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(384, 0, 128, 32));
// Left widget: size hint and positioned on the right
// Right widget: size hint and positioned on the left of the right half
fast_stretch->setAlignment(sc::AlignLeft);
box_layout_stretch->update();
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(221, 0, 32, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(258, 0, 32, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(221, 0, 32, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(258, 0, 32, 32));
// Also check vertical alignment
stretch_widget->setAlignment(sc::AlignLeft | sc::AlignTop);
fast_stretch->setAlignment(sc::AlignLeft | sc::AlignBottom);
box_layout_stretch->setGeometry(SGRecti(0,0,512,64));
- BOOST_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 32, 32));
- BOOST_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(258, 32, 32, 32));
+ SG_CHECK_EQUAL(stretch_widget->geometry(), SGRecti(0, 0, 32, 32));
+ SG_CHECK_EQUAL(fast_stretch->geometry(), SGRecti(258, 32, 32, 32));
}
//------------------------------------------------------------------------------
// Test more space then preferred, but less than maximum
-BOOST_AUTO_TEST_CASE( hbox_pref_to_max )
+void test_hbox_pref_to_max()
{
sc::BoxLayoutRef hbox(new sc::HBoxLayout());
TestWidgetRef w1( new TestWidget( SGVec2i(16, 16),
@@ -242,32 +230,32 @@ BOOST_AUTO_TEST_CASE( hbox_pref_to_max )
hbox->setGeometry( SGRecti(0, 0, 256, 32) );
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 126, 32));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(131, 0, 125, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 126, 32));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(131, 0, 125, 32));
hbox->setStretch(0, 1);
hbox->setStretch(1, 1);
- BOOST_CHECK_EQUAL(hbox->stretch(0), 1);
- BOOST_CHECK_EQUAL(hbox->stretch(1), 1);
+ SG_CHECK_EQUAL(hbox->stretch(0), 1);
+ SG_CHECK_EQUAL(hbox->stretch(1), 1);
hbox->update();
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 125, 32));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(130, 0, 126, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 125, 32));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(130, 0, 126, 32));
- BOOST_REQUIRE( hbox->setStretchFactor(w1, 2) );
- BOOST_REQUIRE( hbox->setStretchFactor(w2, 3) );
- BOOST_CHECK_EQUAL(hbox->stretch(0), 2);
- BOOST_CHECK_EQUAL(hbox->stretch(1), 3);
+ SG_VERIFY(hbox->setStretchFactor(w1, 2));
+ SG_VERIFY(hbox->setStretchFactor(w2, 3));
+ SG_CHECK_EQUAL(hbox->stretch(0), 2);
+ SG_CHECK_EQUAL(hbox->stretch(1), 3);
hbox->removeItem(w1);
- BOOST_CHECK( !hbox->setStretchFactor(w1, 0) );
+ SG_VERIFY(!hbox->setStretchFactor(w1, 0));
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( spacer_layouting )
+void test_spacer_layouting()
{
sc::HBoxLayout hbox;
TestWidgetRef w1( new TestWidget( SGVec2i(16, 16),
@@ -279,31 +267,31 @@ BOOST_AUTO_TEST_CASE( spacer_layouting )
hbox.addItem(w2);
hbox.addStretch(1);
- BOOST_CHECK_EQUAL(hbox.minimumSize(), SGVec2i(37, 16));
- BOOST_CHECK_EQUAL(hbox.sizeHint(), SGVec2i(69, 32));
- BOOST_CHECK_EQUAL(hbox.maximumSize(), sc::LayoutItem::MAX_SIZE);
+ SG_CHECK_EQUAL(hbox.minimumSize(), SGVec2i(37, 16));
+ SG_CHECK_EQUAL(hbox.sizeHint(), SGVec2i(69, 32));
+ SG_CHECK_EQUAL(hbox.maximumSize(), sc::LayoutItem::MAX_SIZE);
hbox.setGeometry(SGRecti(0, 0, 256, 40));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 32, 40));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(37, 0, 32, 40));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 32, 40));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(37, 0, 32, 40));
// now center with increased spacing between both widgets
hbox.insertStretch(0, 1);
hbox.insertSpacing(2, 10);
- BOOST_CHECK_EQUAL(hbox.minimumSize(), SGVec2i(47, 16));
- BOOST_CHECK_EQUAL(hbox.sizeHint(), SGVec2i(79, 32));
- BOOST_CHECK_EQUAL(hbox.maximumSize(), sc::LayoutItem::MAX_SIZE);
+ SG_CHECK_EQUAL(hbox.minimumSize(), SGVec2i(47, 16));
+ SG_CHECK_EQUAL(hbox.sizeHint(), SGVec2i(79, 32));
+ SG_CHECK_EQUAL(hbox.maximumSize(), sc::LayoutItem::MAX_SIZE);
hbox.update();
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(88, 0, 32, 40));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(135, 0, 32, 40));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(88, 0, 32, 40));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(135, 0, 32, 40));
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( vertical_layout)
+void test_vertical_layout()
{
sc::BoxLayout vbox(sc::BoxLayout::TopToBottom);
vbox.setSpacing(7);
@@ -318,26 +306,26 @@ BOOST_AUTO_TEST_CASE( vertical_layout)
vbox.addItem(fixed_size_widget);
vbox.addItem(limited_resize_widget);
- BOOST_CHECK_EQUAL(vbox.minimumSize(), SGVec2i(16, 39));
- BOOST_CHECK_EQUAL(vbox.sizeHint(), SGVec2i(32, 55));
- BOOST_CHECK_EQUAL(vbox.maximumSize(), SGVec2i(256, 87));
+ SG_CHECK_EQUAL(vbox.minimumSize(), SGVec2i(16, 39));
+ SG_CHECK_EQUAL(vbox.sizeHint(), SGVec2i(32, 55));
+ SG_CHECK_EQUAL(vbox.maximumSize(), SGVec2i(256, 87));
vbox.setGeometry(SGRecti(10, 20, 16, 55));
- BOOST_CHECK_EQUAL(fixed_size_widget->geometry(), SGRecti(10, 20, 16, 16));
- BOOST_CHECK_EQUAL(limited_resize_widget->geometry(), SGRecti(10, 43, 16, 32));
+ SG_CHECK_EQUAL(fixed_size_widget->geometry(), SGRecti(10, 20, 16, 16));
+ SG_CHECK_EQUAL(limited_resize_widget->geometry(), SGRecti(10, 43, 16, 32));
vbox.setDirection(sc::BoxLayout::BottomToTop);
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( boxlayout_insert_remove )
+void test_boxlayout_insert_remove()
{
sc::BoxLayoutRef hbox( new sc::HBoxLayout );
- BOOST_CHECK_EQUAL(hbox->count(), 0);
- BOOST_CHECK(!hbox->itemAt(0));
- BOOST_CHECK(!hbox->takeAt(0));
+ SG_CHECK_EQUAL(hbox->count(), 0);
+ SG_VERIFY(!hbox->itemAt(0));
+ SG_VERIFY(!hbox->takeAt(0));
TestWidgetRef w1( new TestWidget( SGVec2i(16, 16),
SGVec2i(32, 32),
@@ -345,33 +333,33 @@ BOOST_AUTO_TEST_CASE( boxlayout_insert_remove )
w2( new TestWidget(*w1) );
hbox->addItem(w1);
- BOOST_CHECK_EQUAL(hbox->count(), 1);
- BOOST_CHECK_EQUAL(hbox->itemAt(0), w1);
- BOOST_CHECK_EQUAL(w1->getParent(), hbox);
+ SG_CHECK_EQUAL(hbox->count(), 1);
+ SG_CHECK_EQUAL_NOSTREAM(hbox->itemAt(0), w1);
+ SG_CHECK_EQUAL_NOSTREAM(w1->getParent(), hbox);
hbox->insertItem(0, w2);
- BOOST_CHECK_EQUAL(hbox->count(), 2);
- BOOST_CHECK_EQUAL(hbox->itemAt(0), w2);
- BOOST_CHECK_EQUAL(hbox->itemAt(1), w1);
- BOOST_CHECK_EQUAL(w2->getParent(), hbox);
+ SG_CHECK_EQUAL(hbox->count(), 2);
+ SG_CHECK_EQUAL_NOSTREAM(hbox->itemAt(0), w2);
+ SG_CHECK_EQUAL_NOSTREAM(hbox->itemAt(1), w1);
+ SG_CHECK_EQUAL_NOSTREAM(w2->getParent(), hbox);
hbox->removeItem(w2);
- BOOST_CHECK_EQUAL(hbox->count(), 1);
- BOOST_CHECK_EQUAL(hbox->itemAt(0), w1);
- BOOST_CHECK( !w2->getParent() );
+ SG_CHECK_EQUAL(hbox->count(), 1);
+ SG_CHECK_EQUAL_NOSTREAM(hbox->itemAt(0), w1);
+ SG_VERIFY(!w2->getParent());
hbox->addItem(w2);
- BOOST_CHECK_EQUAL(hbox->count(), 2);
- BOOST_CHECK_EQUAL(w2->getParent(), hbox);
+ SG_CHECK_EQUAL(hbox->count(), 2);
+ SG_CHECK_EQUAL_NOSTREAM(w2->getParent(), hbox);
hbox->clear();
- BOOST_CHECK_EQUAL(hbox->count(), 0);
- BOOST_CHECK( !w1->getParent() );
- BOOST_CHECK( !w2->getParent() );
+ SG_CHECK_EQUAL(hbox->count(), 0);
+ SG_VERIFY(!w1->getParent());
+ SG_VERIFY(!w2->getParent());
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( boxlayout_visibility )
+void test_boxlayout_visibility()
{
sc::BoxLayoutRef hbox( new sc::HBoxLayout );
TestWidgetRef w1( new TestWidget( SGVec2i(16, 16),
@@ -383,67 +371,67 @@ BOOST_AUTO_TEST_CASE( boxlayout_visibility )
hbox->addItem(w2);
hbox->addItem(w3);
- BOOST_REQUIRE_EQUAL(hbox->sizeHint().x(), 3 * 32 + 2 * hbox->spacing());
+ SG_CHECK_EQUAL(hbox->sizeHint().x(), 3 * 32 + 2 * hbox->spacing());
hbox->setGeometry(SGRecti(0, 0, 69, 32));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 20, 32));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(25, 0, 20, 32));
- BOOST_CHECK_EQUAL(w3->geometry(), SGRecti(50, 0, 19, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 20, 32));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(25, 0, 20, 32));
+ SG_CHECK_EQUAL(w3->geometry(), SGRecti(50, 0, 19, 32));
w2->setVisible(false);
- BOOST_REQUIRE(hbox->isVisible());
- BOOST_REQUIRE(w1->isVisible());
- BOOST_REQUIRE(!w2->isVisible());
- BOOST_REQUIRE(w2->isExplicitlyHidden());
- BOOST_REQUIRE(w3->isVisible());
+ SG_VERIFY(hbox->isVisible());
+ SG_VERIFY(w1->isVisible());
+ SG_VERIFY(!w2->isVisible());
+ SG_VERIFY(w2->isExplicitlyHidden());
+ SG_VERIFY(w3->isVisible());
- BOOST_CHECK_EQUAL(hbox->sizeHint().x(), 2 * 32 + 1 * hbox->spacing());
+ SG_CHECK_EQUAL(hbox->sizeHint().x(), 2 * 32 + 1 * hbox->spacing());
hbox->update();
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 32, 32));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(0, 0, 0, 0));
- BOOST_CHECK_EQUAL(w3->geometry(), SGRecti(37, 0, 32, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 32, 32));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(0, 0, 0, 0));
+ SG_CHECK_EQUAL(w3->geometry(), SGRecti(37, 0, 32, 32));
hbox->setVisible(false);
- BOOST_REQUIRE(!hbox->isVisible());
- BOOST_REQUIRE(hbox->isExplicitlyHidden());
- BOOST_REQUIRE(!w1->isVisible());
- BOOST_REQUIRE(!w1->isExplicitlyHidden());
- BOOST_REQUIRE(!w2->isVisible());
- BOOST_REQUIRE(w2->isExplicitlyHidden());
- BOOST_REQUIRE(!w3->isVisible());
- BOOST_REQUIRE(!w3->isExplicitlyHidden());
+ SG_VERIFY(!hbox->isVisible());
+ SG_VERIFY(hbox->isExplicitlyHidden());
+ SG_VERIFY(!w1->isVisible());
+ SG_VERIFY(!w1->isExplicitlyHidden());
+ SG_VERIFY(!w2->isVisible());
+ SG_VERIFY(w2->isExplicitlyHidden());
+ SG_VERIFY(!w3->isVisible());
+ SG_VERIFY(!w3->isExplicitlyHidden());
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 0, 0));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(0, 0, 0, 0));
- BOOST_CHECK_EQUAL(w3->geometry(), SGRecti(0, 0, 0, 0));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 0, 0));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(0, 0, 0, 0));
+ SG_CHECK_EQUAL(w3->geometry(), SGRecti(0, 0, 0, 0));
w2->setVisible(true);
- BOOST_REQUIRE(!w2->isVisible());
- BOOST_REQUIRE(!w2->isExplicitlyHidden());
+ SG_VERIFY(!w2->isVisible());
+ SG_VERIFY(!w2->isExplicitlyHidden());
hbox->setVisible(true);
- BOOST_REQUIRE(hbox->isVisible());
- BOOST_REQUIRE(w1->isVisible());
- BOOST_REQUIRE(w2->isVisible());
- BOOST_REQUIRE(w3->isVisible());
+ SG_VERIFY(hbox->isVisible());
+ SG_VERIFY(w1->isVisible());
+ SG_VERIFY(w2->isVisible());
+ SG_VERIFY(w3->isVisible());
hbox->update();
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 20, 32));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(25, 0, 20, 32));
- BOOST_CHECK_EQUAL(w3->geometry(), SGRecti(50, 0, 19, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 20, 32));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(25, 0, 20, 32));
+ SG_CHECK_EQUAL(w3->geometry(), SGRecti(50, 0, 19, 32));
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE(boxlayout_equal)
+void test_boxlayout_equal()
{
sc::BoxLayoutRef hbox( new sc::HBoxLayout );
TestWidgetRef w1(new TestWidget(SGVec2i(16, 16),
@@ -464,70 +452,70 @@ BOOST_AUTO_TEST_CASE(boxlayout_equal)
hbox->setEqualsItem(w2);
hbox->setStretchFactor(w3, 1);
- BOOST_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(106, 16));
- BOOST_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(162, 40));
+ SG_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(106, 16));
+ SG_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(162, 40));
hbox->setGeometry(SGRecti(0, 0, 256, 40));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 60, 40));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(65, 0, 60, 40));
- BOOST_CHECK_EQUAL(w3->geometry(), SGRecti(130, 0, 126, 40));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 60, 40));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(65, 0, 60, 40));
+ SG_CHECK_EQUAL(w3->geometry(), SGRecti(130, 0, 126, 40));
- // visibility
+ // visibility
w2->setVisible(false);
- BOOST_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(37, 16));
- BOOST_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(69, 32));
+ SG_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(37, 16));
+ SG_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(69, 32));
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( boxlayout_contents_margins )
+void test_boxlayout_contents_margins()
{
sc::Margins m;
- BOOST_REQUIRE(m.isNull());
+ SG_VERIFY(m.isNull());
m = sc::Margins(5);
- BOOST_REQUIRE_EQUAL(m.l, 5);
- BOOST_REQUIRE_EQUAL(m.t, 5);
- BOOST_REQUIRE_EQUAL(m.r, 5);
- BOOST_REQUIRE_EQUAL(m.b, 5);
+ SG_CHECK_EQUAL(m.l, 5);
+ SG_CHECK_EQUAL(m.t, 5);
+ SG_CHECK_EQUAL(m.r, 5);
+ SG_CHECK_EQUAL(m.b, 5);
m = sc::Margins(6, 7);
- BOOST_REQUIRE_EQUAL(m.l, 6);
- BOOST_REQUIRE_EQUAL(m.t, 7);
- BOOST_REQUIRE_EQUAL(m.r, 6);
- BOOST_REQUIRE_EQUAL(m.b, 7);
+ SG_CHECK_EQUAL(m.l, 6);
+ SG_CHECK_EQUAL(m.t, 7);
+ SG_CHECK_EQUAL(m.r, 6);
+ SG_CHECK_EQUAL(m.b, 7);
- BOOST_REQUIRE_EQUAL(m.horiz(), 12);
- BOOST_REQUIRE_EQUAL(m.vert(), 14);
- BOOST_REQUIRE(!m.isNull());
+ SG_CHECK_EQUAL(m.horiz(), 12);
+ SG_CHECK_EQUAL(m.vert(), 14);
+ SG_VERIFY(!m.isNull());
m = sc::Margins(1, 2, 3, 4);
- BOOST_REQUIRE_EQUAL(m.l, 1);
- BOOST_REQUIRE_EQUAL(m.t, 2);
- BOOST_REQUIRE_EQUAL(m.r, 3);
- BOOST_REQUIRE_EQUAL(m.b, 4);
+ SG_CHECK_EQUAL(m.l, 1);
+ SG_CHECK_EQUAL(m.t, 2);
+ SG_CHECK_EQUAL(m.r, 3);
+ SG_CHECK_EQUAL(m.b, 4);
- BOOST_REQUIRE_EQUAL(m.horiz(), 4);
- BOOST_REQUIRE_EQUAL(m.vert(), 6);
- BOOST_REQUIRE_EQUAL(m.size(), SGVec2i(4, 6));
+ SG_CHECK_EQUAL(m.horiz(), 4);
+ SG_CHECK_EQUAL(m.vert(), 6);
+ SG_CHECK_EQUAL(m.size(), SGVec2i(4, 6));
sc::BoxLayoutRef hbox( new sc::HBoxLayout );
hbox->setContentsMargins(5, 10, 15, 20);
- BOOST_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(20, 30));
- BOOST_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(20, 30));
- BOOST_CHECK_EQUAL(hbox->maximumSize(), SGVec2i(20, 30));
+ SG_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(20, 30));
+ SG_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(20, 30));
+ SG_CHECK_EQUAL(hbox->maximumSize(), SGVec2i(20, 30));
hbox->setGeometry(SGRecti(0, 0, 30, 40));
- BOOST_CHECK_EQUAL(hbox->geometry(), SGRecti(0, 0, 30, 40));
- BOOST_CHECK_EQUAL(hbox->contentsRect(), SGRecti(5, 10, 10, 10));
+ SG_CHECK_EQUAL(hbox->geometry(), SGRecti(0, 0, 30, 40));
+ SG_CHECK_EQUAL(hbox->contentsRect(), SGRecti(5, 10, 10, 10));
TestWidgetRef w1( new TestWidget( SGVec2i(16, 16),
SGVec2i(32, 32) ) ),
@@ -538,57 +526,57 @@ BOOST_AUTO_TEST_CASE( boxlayout_contents_margins )
w2->setContentsMargin(6);
w3->setContentsMargin(7);
- BOOST_CHECK_EQUAL(w1->minimumSize(), SGVec2i(26, 26));
- BOOST_CHECK_EQUAL(w1->sizeHint(), SGVec2i(42, 42));
- BOOST_CHECK_EQUAL(w1->maximumSize(), sc::LayoutItem::MAX_SIZE);
+ SG_CHECK_EQUAL(w1->minimumSize(), SGVec2i(26, 26));
+ SG_CHECK_EQUAL(w1->sizeHint(), SGVec2i(42, 42));
+ SG_CHECK_EQUAL(w1->maximumSize(), sc::LayoutItem::MAX_SIZE);
- BOOST_CHECK_EQUAL(w2->minimumSize(), SGVec2i(28, 28));
- BOOST_CHECK_EQUAL(w2->sizeHint(), SGVec2i(44, 44));
- BOOST_CHECK_EQUAL(w2->maximumSize(), sc::LayoutItem::MAX_SIZE);
+ SG_CHECK_EQUAL(w2->minimumSize(), SGVec2i(28, 28));
+ SG_CHECK_EQUAL(w2->sizeHint(), SGVec2i(44, 44));
+ SG_CHECK_EQUAL(w2->maximumSize(), sc::LayoutItem::MAX_SIZE);
- BOOST_CHECK_EQUAL(w3->minimumSize(), SGVec2i(30, 30));
- BOOST_CHECK_EQUAL(w3->sizeHint(), SGVec2i(46, 46));
- BOOST_CHECK_EQUAL(w3->maximumSize(), sc::LayoutItem::MAX_SIZE);
+ SG_CHECK_EQUAL(w3->minimumSize(), SGVec2i(30, 30));
+ SG_CHECK_EQUAL(w3->sizeHint(), SGVec2i(46, 46));
+ SG_CHECK_EQUAL(w3->maximumSize(), sc::LayoutItem::MAX_SIZE);
hbox->addItem(w1);
hbox->addItem(w2);
hbox->addItem(w3);
- BOOST_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(114, 60));
- BOOST_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(162, 76));
- BOOST_CHECK_EQUAL(hbox->maximumSize(), sc::LayoutItem::MAX_SIZE);
+ SG_CHECK_EQUAL(hbox->minimumSize(), SGVec2i(114, 60));
+ SG_CHECK_EQUAL(hbox->sizeHint(), SGVec2i(162, 76));
+ SG_CHECK_EQUAL(hbox->maximumSize(), sc::LayoutItem::MAX_SIZE);
hbox->setGeometry(SGRecti(0, 0, hbox->sizeHint().x(), hbox->sizeHint().y()));
- BOOST_CHECK_EQUAL(hbox->contentsRect(), SGRecti(5, 10, 142, 46));
+ SG_CHECK_EQUAL(hbox->contentsRect(), SGRecti(5, 10, 142, 46));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(5, 10, 42, 46));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(52, 10, 44, 46));
- BOOST_CHECK_EQUAL(w3->geometry(), SGRecti(101, 10, 46, 46));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(5, 10, 42, 46));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(52, 10, 44, 46));
+ SG_CHECK_EQUAL(w3->geometry(), SGRecti(101, 10, 46, 46));
- BOOST_CHECK_EQUAL(w1->contentsRect(), SGRecti(10, 15, 32, 36));
- BOOST_CHECK_EQUAL(w2->contentsRect(), SGRecti(58, 16, 32, 34));
- BOOST_CHECK_EQUAL(w3->contentsRect(), SGRecti(108, 17, 32, 32));
+ SG_CHECK_EQUAL(w1->contentsRect(), SGRecti(10, 15, 32, 36));
+ SG_CHECK_EQUAL(w2->contentsRect(), SGRecti(58, 16, 32, 34));
+ SG_CHECK_EQUAL(w3->contentsRect(), SGRecti(108, 17, 32, 32));
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( boxlayout_hfw )
+void test_boxlayout_hfw()
{
TestWidgetRef w1( new TestWidgetHFW( SGVec2i(16, 16),
SGVec2i(32, 32) ) ),
w2( new TestWidgetHFW( SGVec2i(24, 24),
SGVec2i(48, 48) ) );
- BOOST_CHECK_EQUAL(w1->heightForWidth(16), 64);
- BOOST_CHECK_EQUAL(w1->minimumHeightForWidth(16), 16);
- BOOST_CHECK_EQUAL(w2->heightForWidth(24), 96);
- BOOST_CHECK_EQUAL(w2->minimumHeightForWidth(24), 24);
+ SG_CHECK_EQUAL(w1->heightForWidth(16), 64);
+ SG_CHECK_EQUAL(w1->minimumHeightForWidth(16), 16);
+ SG_CHECK_EQUAL(w2->heightForWidth(24), 96);
+ SG_CHECK_EQUAL(w2->minimumHeightForWidth(24), 24);
TestWidgetRef w_no_hfw( new TestWidget( SGVec2i(16, 16),
SGVec2i(32, 32) ) );
- BOOST_CHECK(!w_no_hfw->hasHeightForWidth());
- BOOST_CHECK_EQUAL(w_no_hfw->heightForWidth(16), -1);
- BOOST_CHECK_EQUAL(w_no_hfw->minimumHeightForWidth(16), -1);
+ SG_VERIFY(!w_no_hfw->hasHeightForWidth());
+ SG_CHECK_EQUAL(w_no_hfw->heightForWidth(16), -1);
+ SG_CHECK_EQUAL(w_no_hfw->minimumHeightForWidth(16), -1);
// horizontal
sc::HBoxLayout hbox;
@@ -596,21 +584,21 @@ BOOST_AUTO_TEST_CASE( boxlayout_hfw )
hbox.addItem(w1);
hbox.addItem(w2);
- BOOST_CHECK_EQUAL(hbox.heightForWidth(45), w2->heightForWidth(24));
- BOOST_CHECK_EQUAL(hbox.heightForWidth(85), w2->heightForWidth(48));
+ SG_CHECK_EQUAL(hbox.heightForWidth(45), w2->heightForWidth(24));
+ SG_CHECK_EQUAL(hbox.heightForWidth(85), w2->heightForWidth(48));
hbox.addItem(w_no_hfw);
- BOOST_CHECK_EQUAL(hbox.heightForWidth(66), 96);
- BOOST_CHECK_EQUAL(hbox.heightForWidth(122), 48);
- BOOST_CHECK_EQUAL(hbox.minimumHeightForWidth(66), 24);
- BOOST_CHECK_EQUAL(hbox.minimumHeightForWidth(122), 16);
+ SG_CHECK_EQUAL(hbox.heightForWidth(66), 96);
+ SG_CHECK_EQUAL(hbox.heightForWidth(122), 48);
+ SG_CHECK_EQUAL(hbox.minimumHeightForWidth(66), 24);
+ SG_CHECK_EQUAL(hbox.minimumHeightForWidth(122), 16);
hbox.setGeometry(SGRecti(0, 0, 66, 24));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 16, 24));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(21, 0, 24, 24));
- BOOST_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(50, 0, 16, 24));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 16, 24));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(21, 0, 24, 24));
+ SG_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(50, 0, 16, 24));
// vertical
sc::VBoxLayout vbox;
@@ -618,52 +606,52 @@ BOOST_AUTO_TEST_CASE( boxlayout_hfw )
vbox.addItem(w1);
vbox.addItem(w2);
- BOOST_CHECK_EQUAL(vbox.heightForWidth(24), 143);
- BOOST_CHECK_EQUAL(vbox.heightForWidth(48), 74);
- BOOST_CHECK_EQUAL(vbox.minimumHeightForWidth(24), 39);
- BOOST_CHECK_EQUAL(vbox.minimumHeightForWidth(48), 22);
+ SG_CHECK_EQUAL(vbox.heightForWidth(24), 143);
+ SG_CHECK_EQUAL(vbox.heightForWidth(48), 74);
+ SG_CHECK_EQUAL(vbox.minimumHeightForWidth(24), 39);
+ SG_CHECK_EQUAL(vbox.minimumHeightForWidth(48), 22);
vbox.addItem(w_no_hfw);
- BOOST_CHECK_EQUAL(vbox.heightForWidth(24), 180);
- BOOST_CHECK_EQUAL(vbox.heightForWidth(48), 111);
- BOOST_CHECK_EQUAL(vbox.minimumHeightForWidth(24), 60);
- BOOST_CHECK_EQUAL(vbox.minimumHeightForWidth(48), 43);
+ SG_CHECK_EQUAL(vbox.heightForWidth(24), 180);
+ SG_CHECK_EQUAL(vbox.heightForWidth(48), 111);
+ SG_CHECK_EQUAL(vbox.minimumHeightForWidth(24), 60);
+ SG_CHECK_EQUAL(vbox.minimumHeightForWidth(48), 43);
SGVec2i min_size = vbox.minimumSize(),
size_hint = vbox.sizeHint();
- BOOST_CHECK_EQUAL(min_size, SGVec2i(24, 66));
- BOOST_CHECK_EQUAL(size_hint, SGVec2i(48, 122));
+ SG_CHECK_EQUAL(min_size, SGVec2i(24, 66));
+ SG_CHECK_EQUAL(size_hint, SGVec2i(48, 122));
vbox.setGeometry(SGRecti(0, 0, 24, 122));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 24, 33));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(0, 38, 24, 47));
- BOOST_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(0, 90, 24, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 24, 33));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(0, 38, 24, 47));
+ SG_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(0, 90, 24, 32));
// Vertical layout modifies size hints, so check if they are correctly
// restored
- BOOST_CHECK_EQUAL(min_size, vbox.minimumSize());
- BOOST_CHECK_EQUAL(size_hint, vbox.sizeHint());
+ SG_CHECK_EQUAL(min_size, vbox.minimumSize());
+ SG_CHECK_EQUAL(size_hint, vbox.sizeHint());
vbox.setGeometry(SGRecti(0, 0, 50, 122));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 50, 25));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(0, 30, 50, 51));
- BOOST_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(0, 86, 50, 36));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 50, 25));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(0, 30, 50, 51));
+ SG_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(0, 86, 50, 36));
// Same geometry as before -> should get same widget geometry
// (check internal size hint cache updates correctly)
vbox.setGeometry(SGRecti(0, 0, 24, 122));
- BOOST_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 24, 33));
- BOOST_CHECK_EQUAL(w2->geometry(), SGRecti(0, 38, 24, 47));
- BOOST_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(0, 90, 24, 32));
+ SG_CHECK_EQUAL(w1->geometry(), SGRecti(0, 0, 24, 33));
+ SG_CHECK_EQUAL(w2->geometry(), SGRecti(0, 38, 24, 47));
+ SG_CHECK_EQUAL(w_no_hfw->geometry(), SGRecti(0, 90, 24, 32));
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( item_alignment_rect )
+void test_item_alignment_rect()
{
TestWidgetRef w1( new TestWidget( SGVec2i(16, 16),
SGVec2i(32, 32) ) );
@@ -671,41 +659,41 @@ BOOST_AUTO_TEST_CASE( item_alignment_rect )
const SGRecti r(10, 10, 64, 64);
// Default: AlignFill -> fill up to maximum size
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), r);
+ SG_CHECK_EQUAL(w1->alignmentRect(r), r);
// Horizontal
// AlignLeft -> width from size hint, positioned on the left
w1->setAlignment(sc::AlignLeft);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 10, 32, 64));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 10, 32, 64));
// AlignRight -> width from size hint, positioned on the left
w1->setAlignment(sc::AlignRight);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(42, 10, 32, 64));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(42, 10, 32, 64));
// AlignHCenter -> width from size hint, positioned in the center
w1->setAlignment(sc::AlignHCenter);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(26, 10, 32, 64));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(26, 10, 32, 64));
// Vertical
// AlignTop -> height from size hint, positioned on the top
w1->setAlignment(sc::AlignTop);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 10, 64, 32));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 10, 64, 32));
// AlignBottom -> height from size hint, positioned on the bottom
w1->setAlignment(sc::AlignBottom);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 42, 64, 32));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 42, 64, 32));
// AlignVCenter -> height from size hint, positioned in the center
w1->setAlignment(sc::AlignVCenter);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 26, 64, 32));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(10, 26, 64, 32));
// Vertical + Horizontal
w1->setAlignment(sc::AlignCenter);
- BOOST_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(26, 26, 32, 32));
+ SG_CHECK_EQUAL(w1->alignmentRect(r), SGRecti(26, 26, 32, 32));
}
//------------------------------------------------------------------------------
@@ -721,7 +709,7 @@ static naRef f_Widget_visibilityChanged(nasal::CallContext ctx)
}
//------------------------------------------------------------------------------
-BOOST_AUTO_TEST_CASE( nasal_widget )
+void test_nasal_widget...
[truncated message content] |