Skip to content

Commit cf61365

Browse files
authored
Merge pull request #714 from openstudiocoalition/sketchup_2024
Updates for SketchUp 2024
2 parents 3d5fb88 + 808ff08 commit cf61365

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+63773
-63592
lines changed

.github/workflows/app_build.yml

+25-11
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ on:
88
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
99
pull_request:
1010
branches: [ master, develop ]
11+
types: [ opened, reopened, synchronize, ready_for_review ]
1112

1213
env:
1314
BUILD_TYPE: Release
1415
BUILD_DOCUMENTATION: OFF
1516
BUILD_TESTING: ON
1617
BUILD_BENCHMARK: ON
1718
BUILD_PACKAGE: ON
18-
QT_VERSION: 6.6.3
19+
QT_VERSION: 6.5.2
20+
QT_DEBUG_PLUGINS: 1
1921

2022
jobs:
2123
build:
22-
# Note: as of 2021-01-29, this only works for push, not for pull request
23-
# if: "!(contains(github.event.head_commit.message, 'skip') && contains(github.event.head_commit.message, 'ci'))"
24+
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
25+
2426
runs-on: ${{ matrix.os }}
2527
continue-on-error: true
2628
strategy:
@@ -130,7 +132,7 @@ jobs:
130132
if [ "$RUNNER_OS" == "Linux" ]; then
131133
echo "Install needed system dependencies for OPENGL (due to Qt) for Linux"
132134
sudo apt update -qq
133-
sudo apt install -y mesa-common-dev libglu1-mesa-dev patchelf ninja-build ccache libxkbcommon-x11-dev libgl1-mesa-dev chrpath libxcb-cursor0
135+
sudo apt install -y mesa-common-dev libglu1-mesa-dev patchelf ninja-build ccache libxkbcommon-x11-dev libgl1-mesa-dev chrpath libxcb-icccm4 libxcb-keysyms1 libxcb-xkb1 libxcb-randr0 libxcb-shape0 libxkbcommon-x11-0 libxcb-cursor0
134136
gcc --version
135137
136138
ccache --set-config=cache_dir=$CCACHE_DIR
@@ -405,7 +407,7 @@ jobs:
405407
cmake -E make_directory ./build
406408
407409
if [ "$RUNNER_OS" == "macOS" ]; then
408-
QT_INSTALL_DIR="/Users/irvinemac/Qt/6.6.3/macos/"
410+
QT_INSTALL_DIR="/Users/irvinemac/Qt/$QT_VERSION/macos/"
409411
fi
410412
411413
echo "$QT_INSTALL_DIR/bin" >> $GITHUB_PATH
@@ -552,9 +554,15 @@ jobs:
552554
# Execute tests defined by the CMake configuration.
553555
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
554556
run: |
555-
Xvfb :99 &
556-
export DISPLAY=:99
557-
ctest -j -T test --output-on-failure --no-compress-output -C $BUILD_TYPE || true
557+
if [ "$RUNNER_OS" == "macOS" ]; then
558+
automationmodetool
559+
export XVFBCMD=""
560+
elif [ "$RUNNER_OS" == "Windows" ]; then
561+
export XVFBCMD=""
562+
else
563+
export XVFBCMD="xvfb-run"
564+
fi
565+
$XVFBCMD ctest -j -T test --output-on-failure --no-compress-output -C $BUILD_TYPE || true
558566
559567
- name: Archive test results?
560568
uses: actions/upload-artifact@v4
@@ -568,9 +576,15 @@ jobs:
568576
# Execute tests defined by the CMake configuration.
569577
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
570578
run: |
571-
Xvfb :99 &
572-
export DISPLAY=:99
573-
Products/SpacesSurfaces_Benchmark --benchmark_out_format=csv --benchmark_out='bench_results_SpacesSurfaces.csv' || true
579+
if [ "$RUNNER_OS" == "macOS" ]; then
580+
automationmodetool
581+
export XVFBCMD=""
582+
elif [ "$RUNNER_OS" == "Windows" ]; then
583+
export XVFBCMD=""
584+
else
585+
export XVFBCMD="xvfb-run"
586+
fi
587+
$XVFBCMD Products/SpacesSurfaces_Benchmark --benchmark_out_format=csv --benchmark_out='bench_results_SpacesSurfaces.csv' || true
574588
575589
- name: Archive benchmark results?
576590
uses: actions/upload-artifact@v4

CMakeLists.txt

+15-4
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ if(WIN32)
477477
# add_compile_definitions(BOOST_USE_WINDOWS_H) # Getting a confict with `typedef GUID UUID` from windows.h
478478
add_compile_definitions(BOOST_WINAPI_DEFINE_VERSION_MACROS)
479479
add_compile_definitions(WIN32_LEAN_AND_MEAN) # That excludes stuff that's not used too often, including the GUID stuff
480+
# TODO: remove when possible, see https://github.com/microsoft/cpprestsdk/issues/1768
481+
add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
480482
endif()
481483

482484
# Check version of gcc
@@ -508,9 +510,18 @@ if(UNIX)
508510
endif()
509511

510512
# Qt
511-
# e.g. QT_INSTALL_DIR = C:/Qt/6.6.3/msvc2019_64
513+
# e.g. QT_INSTALL_DIR = C:/Qt/6.5.2/msvc2019_64
512514
set(QT_INSTALL_DIR "" CACHE PATH "Path to Qt Install")
513-
set(QT_VERSION "6.6.3")
515+
set(QT_VERSION "6.5.2" CACHE STRING "Qt target version, defaults to 6.5.2")
516+
517+
# For AboutBox, but also validates that the version is valid
518+
string(REGEX MATCH "^([0-9]+\\.[0-9]+)"
519+
QT_VERSION_MAJOR_MINOR ${QT_VERSION})
520+
if(NOT QT_VERSION_MAJOR_MINOR)
521+
message(FATAL_ERROR "Failed to match QT_VERSION=${QT_VERSION}")
522+
endif()
523+
set(QT_DOC_LINK "https://doc.qt.io/qt-${QT_VERSION_MAJOR_MINOR}/qtmodules.html")
524+
514525

515526
# TODO: how to set OPENSSL_ROOT_DIR to a generator expression?
516527
set(OPENSSL_ROOT_DIR ${CONAN_OPENSSL_ROOT_RELEASE})
@@ -534,7 +545,7 @@ find_file(qweb_resources NAMES qtwebengine_resources.pak PATHS "${QT_INSTALL_DIR
534545
find_file(qweb_resources_devtools NAMES qtwebengine_devtools_resources.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
535546
find_file(qweb_resources_100 NAMES qtwebengine_resources_100p.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
536547
find_file(qweb_resources_200 NAMES qtwebengine_resources_200p.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
537-
find_file(qweb_resources_v8_context_snapshot NAMES v8_context_snapshot.bin PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
548+
#find_file(qweb_resources_v8_context_snapshot NAMES v8_context_snapshot.bin PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
538549

539550
# QT_WEB_LIBS are linked by OS App and openstudio_lib but not by openstudio_modeleditor.so or openstudio_modeleditor
540551
list(APPEND QT_WEB_LIBS Qt6::WebEngineCore)
@@ -608,7 +619,7 @@ if(WIN32)
608619
endif()
609620

610621
if(UNIX AND NOT APPLE)
611-
# Apparently libqxcb.so depends on libQt6OpenGL.so in Qt 6.6.3 (it depended on libGL on 5.15.0 but not OpenGL)
622+
# Apparently libqxcb.so depends on libQt6OpenGL.so in Qt 6 (it depended on libGL on 5.15.0 but not OpenGL)
612623
find_package(Qt6OpenGL ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
613624
list(APPEND QT_LIBS Qt6::OpenGL)
614625
endif()

FindOpenStudioSDK.cmake

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set(OPENSTUDIO_VERSION_PATCH 0)
44
set(OPENSTUDIO_VERSION "${OPENSTUDIO_VERSION_MAJOR}.${OPENSTUDIO_VERSION_MINOR}.${OPENSTUDIO_VERSION_PATCH}")
55

66
#If this is an official release, leave this "", otherwise put for eg '-rc1'
7-
set(OPENSTUDIO_VERSION_PRERELEASE "-rc2")
7+
set(OPENSTUDIO_VERSION_PRERELEASE "")
88
# Enter SHA, always, eg "+79857912c4"
9-
set(OPENSTUDIO_VERSION_SHA "+af997f4fef")
9+
set(OPENSTUDIO_VERSION_SHA "+f953b6fcaf")
1010

1111
# Paths where the cmake-downloaded archives will be put
1212
set(OPENSTUDIO_ARCHIVE_DIR "${PROJECT_BINARY_DIR}/OpenStudio-${OPENSTUDIO_VERSION}")
@@ -17,27 +17,27 @@ set(OPENSTUDIO_EXT "tar.gz")
1717
if(APPLE)
1818
set(OPENSTUDIO_PLATFORM "Darwin-${ARCH}")
1919
if(ARCH MATCHES "arm64")
20-
set(OPENSTUDIO_EXPECTED_HASH 6a68bd93010d3fd5e7236913af956a76)
20+
set(OPENSTUDIO_EXPECTED_HASH 0e983b1a7bd2eed2b27c866125e0716b)
2121
else()
22-
set(OPENSTUDIO_EXPECTED_HASH bb5e18b91537125689590038177c85a4)
22+
set(OPENSTUDIO_EXPECTED_HASH 8be3effb0599888511958999774df569)
2323
endif()
2424

2525
elseif(UNIX)
2626
set(OPENSTUDIO_PLATFORM "${LSB_RELEASE_ID_SHORT}-${LSB_RELEASE_VERSION_SHORT}-${ARCH}")
2727
if(LSB_RELEASE_VERSION_SHORT MATCHES "22.04")
2828
if (ARCH MATCHES "arm64")
29-
set(OPENSTUDIO_EXPECTED_HASH 57b2a8e706999a6eb1acbfbacf13241a)
29+
set(OPENSTUDIO_EXPECTED_HASH ff544a9dfa4846de6af959a0c1ec926d)
3030
else()
31-
set(OPENSTUDIO_EXPECTED_HASH 6b81e79fe69d0860d94922967b881855)
31+
set(OPENSTUDIO_EXPECTED_HASH b14c71b37a01040f3216abc68488ed62)
3232
endif()
3333
elseif(LSB_RELEASE_VERSION_SHORT MATCHES "20.04")
34-
set(OPENSTUDIO_EXPECTED_HASH 171510ee1a23d0542d0f71a9388d3bc3)
34+
set(OPENSTUDIO_EXPECTED_HASH 98539ab193b15a140146add5e089900c)
3535
else()
3636
message(FATAL_ERROR "OpenStudio SDK no longer provides packages for Ubuntu 18.04")
3737
endif()
3838

3939
elseif(WIN32)
40-
set(OPENSTUDIO_EXPECTED_HASH 9230fddeb444a2792e575278c97c4335)
40+
set(OPENSTUDIO_EXPECTED_HASH 26395d446a91a0042d3976cabd0fb5ab)
4141
set(OPENSTUDIO_PLATFORM "Windows")
4242
endif()
4343

ProjectMacros.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ macro(CREATE_TEST_TARGETS BASE_NAME SRC DEPENDENCIES)
140140
endif()
141141

142142
target_link_libraries(${BASE_NAME}_tests
143-
gtest::gtest
143+
GTest::gtest
144144
${ALL_DEPENDENCIES}
145145
)
146146

ci/clang-format.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ then
3333
fi
3434

3535
# first find if any files changed
36-
num=$(git diff $PR_BRANCH_NAME $TARGET_BRANCH_NAME --name-only | /bin/grep '.*\.\(cpp\|c\|cxx\|cxx.in\|hpp\|h\|hxx\|hxx.in\)$' | wc -l | tr -d '[:space:]')
36+
num=$(git diff $PR_BRANCH_NAME $TARGET_BRANCH_NAME --name-only | grep '.*\.\(cpp\|c\|cxx\|cxx.in\|hpp\|h\|hxx\|hxx.in\)$' | wc -l | tr -d '[:space:]')
3737
if [ $num -eq 0 ]
3838
then
3939
echo "No files of type (cpp, c, cxx, cxx.in, hpp, h, hxx, hxx.in) changed. Skipping clang-formatting"
4040
exit 0
4141
fi
4242

43-
git diff $PR_BRANCH_NAME $TARGET_BRANCH_NAME --name-only | /bin/grep '.*\.\(cpp\|c\|cxx\|cxx.in\|hpp\|h\|hxx\|hxx.in\)$' | xargs clang-format -style=file -i -fallback-style=none
43+
git diff $PR_BRANCH_NAME $TARGET_BRANCH_NAME --name-only | grep '.*\.\(cpp\|c\|cxx\|cxx.in\|hpp\|h\|hxx\|hxx.in\)$' | xargs clang-format -style=file -i -fallback-style=none
4444

4545
# clang-format will auto correct files so prepare the diff and use this as artifact
4646
git diff > clang_format.patch

developer/ruby/GitHubIssueStats.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def print_issue(issue)
6161
if !ENV['GITHUB_TOKEN'].nil?
6262
token = ENV['GITHUB_TOKEN']
6363
@github = Github.new oauth_token: token
64-
elsif File.exists?(Dir.home + '/github_config.yml')
64+
elsif File.exist?(Dir.home + '/github_config.yml')
6565
github_options = YAML.load_file(Dir.home + '/github_config.yml')
6666
token = github_options['oauth_token']
6767
@github = Github.new oauth_token: token

ruby/CMakeLists.txt

+72-34
Original file line numberDiff line numberDiff line change
@@ -112,53 +112,91 @@ if(BUILD_TESTING)
112112
# find all tests
113113
file(GLOB RUBY_TEST_SRC "test/*.rb")
114114

115-
# TODO: It doesn't work with this executable that's in build/Ruby-install/bin
116-
# message("RUBY_EXECUTABLE=${RUBY_EXECUTABLE}")
117115

118-
# I added FindRuby.cmake from cmake 3.18.2 (after patching cmake to support versions greater than 2 and adding RVM support) in the CMake folder which is part of the CMAKE_MODULE_PATH
119-
set(Ruby_FIND_VIRTUALENV FIRST)
120-
find_package(Ruby 2.7)
116+
# **NOTE**: we do not want to grab the conan one, which is statically built on all platforms, and is a msvc build on windows
117+
# Instead, we want to grab the regularly installed one on your system
121118

122-
if(NOT Ruby_EXECUTABLE)
123-
message(WARNING "Your system ruby wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.")
124-
else()
125-
message(STATUS "Found Ruby_EXECUTABLE=${Ruby_EXECUTABLE}")
126-
endif()
119+
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES
120+
ruby
121+
ruby3.2
122+
ruby3.2.2
123+
ruby32
124+
ruby322
125+
)
127126

128-
# add a test for each unit test
129-
set(RUBY_TEST_REQUIRES "#include test files")
130-
foreach(f ${RUBY_TEST_SRC})
127+
# TODO: this isn't great but I haven't found a better way to locate the system ruby (and avoid the conan one)
128+
find_program(SYSTEM_RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}
129+
HINTS
130+
"/usr/local/rvm/rubies/ruby-3.2.2/bin/"
131+
"/usr/local/rvm/rubies/ruby-3.2.2/bin/ruby"
132+
"/usr/share/rvm/rubies/ruby-3.2.2/bin/"
133+
"$ENV{HOME}/.rvm/rubies/ruby-3.2.2/bin/"
134+
"$ENV{HOME}/.rbenv/versions/3.2.2/bin/"
135+
136+
"C:/Ruby32-x64/bin/"
137+
138+
"/usr/local/ruby322/bin/"
139+
"/usr/local/ruby32/bin/"
140+
"/usr/bin/"
141+
"/usr/local/bin/"
142+
143+
NO_DEFAULT_PATH)
144+
145+
if(SYSTEM_RUBY_EXECUTABLE)
146+
# Validate the version
147+
execute_process (COMMAND "${SYSTEM_RUBY_EXECUTABLE}" -e "puts RUBY_VERSION"
148+
RESULT_VARIABLE _result
149+
OUTPUT_VARIABLE _system_ruby_version
150+
ERROR_QUIET
151+
OUTPUT_STRIP_TRAILING_WHITESPACE)
152+
if(_result OR (_system_ruby_version VERSION_LESS 3.2) OR (_system_ruby_version VERSION_GREATER_EQUAL 3.3))
153+
if(_result)
154+
message(WARNING "Cannot use the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\"")
155+
else()
156+
message(WARNING "Wrong version \"${_system_ruby_version}\" for the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\", not >= 3.2 < 3.3")
157+
endif()
158+
set_property (CACHE SYSTEM_RUBY_EXECUTABLE PROPERTY VALUE "SYSTEM_RUBY_EXECUTABLE-NOTFOUND")
159+
else()
160+
message(STATUS "Found SYSTEM_RUBY_EXECUTABLE=${SYSTEM_RUBY_EXECUTABLE} with version ${_system_ruby_version}")
161+
endif()
162+
endif()
163+
164+
if(NOT SYSTEM_RUBY_EXECUTABLE)
165+
message(WARNING "A valid system ruby (3.2.2 or near) wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.")
166+
else()
167+
# add a test for each unit test
168+
set(RUBY_TEST_REQUIRES "#include test files")
169+
foreach(f ${RUBY_TEST_SRC})
131170

132-
file(READ "${f}" CONTENTS)
133-
string(REGEX MATCHALL "def +test_([A-Za-z_0-9 ]+)" FOUND_TESTS ${CONTENTS})
171+
file(READ "${f}" CONTENTS)
172+
string(REGEX MATCHALL "def +test_([A-Za-z_0-9 ]+)" FOUND_TESTS ${CONTENTS})
134173

135-
foreach(HIT ${FOUND_TESTS})
136-
string(REGEX REPLACE "def +test_([A-Za-z_0-9]+)" "\\1" TEST_NAME ${HIT})
137-
string(REGEX MATCH "/?([A-Za-z_0-9 ]+)\\.rb" FILE_NAME ${f})
138-
string(REGEX REPLACE "/?([A-Za-z_0-9 ]+)\\.rb" "\\1" FILE_NAME ${FILE_NAME})
174+
foreach(HIT ${FOUND_TESTS})
175+
string(REGEX REPLACE "def +test_([A-Za-z_0-9]+)" "\\1" TEST_NAME ${HIT})
176+
string(REGEX MATCH "/?([A-Za-z_0-9 ]+)\\.rb" FILE_NAME ${f})
177+
string(REGEX REPLACE "/?([A-Za-z_0-9 ]+)\\.rb" "\\1" FILE_NAME ${FILE_NAME})
139178

140-
# DLM: Cannot load openstudio_modeleditor.so into CLI because linked with different version of Ruby
141-
# CLI Test
142-
#add_test(NAME "OSApp-CLITest-${FILE_NAME}-${TEST_NAME}"
143-
# COMMAND "${CMAKE_COMMAND}" -E chdir "${CMAKE_CURRENT_BINARY_DIR}"
144-
# "${openstudio_EXECUTABLE}" "-I" "$<TARGET_FILE_DIR:openstudio_modeleditor_rb>"
145-
# "${f}" "--name=test_${TEST_NAME}"
146-
#)
179+
set(CTEST_NAME "OSApp-RubyTest-${FILE_NAME}-${TEST_NAME}")
147180

148-
#set_tests_properties("OSApp-CLITest-${FILE_NAME}-${TEST_NAME}" PROPERTIES TIMEOUT 660 )
181+
# DLM: Cannot load openstudio_modeleditor.so into CLI because linked with different version of Ruby
182+
# CLI Test
183+
#add_test(NAME "OSApp-CLITest-${FILE_NAME}-${TEST_NAME}"
184+
# COMMAND "${CMAKE_COMMAND}" -E chdir "${CMAKE_CURRENT_BINARY_DIR}"
185+
# "${openstudio_EXECUTABLE}" "-I" "$<TARGET_FILE_DIR:openstudio_modeleditor_rb>"
186+
# "${f}" "--name=test_${TEST_NAME}"
187+
#)
149188

150-
if (Ruby_EXECUTABLE)
151189
# Call with Ruby itself
152-
add_test(NAME "OSApp-RubyTest-${FILE_NAME}-${TEST_NAME}"
190+
add_test(NAME "${CTEST_NAME}"
153191
COMMAND "${CMAKE_COMMAND}" -E chdir "${CMAKE_CURRENT_BINARY_DIR}"
154-
"${Ruby_EXECUTABLE}" "-I" "$<TARGET_FILE_DIR:openstudio::openstudio_rb>" # Or just ${openstudio_ROOT_DIR}/Ruby
192+
"${SYSTEM_RUBY_EXECUTABLE}" "-I" "$<TARGET_FILE_DIR:openstudio::openstudio_rb>" # Or just ${openstudio_ROOT_DIR}/Ruby
155193
"-I" "$<TARGET_FILE_DIR:openstudio_modeleditor_rb>"
156194
"${f}" "--name=test_${TEST_NAME}"
157195
)
158-
159-
set_tests_properties("OSApp-RubyTest-${FILE_NAME}-${TEST_NAME}" PROPERTIES TIMEOUT 660 )
160-
endif()
196+
set_tests_properties("${CTEST_NAME}" PROPERTIES TIMEOUT 660 )
197+
endforeach()
161198

162199
endforeach()
163-
endforeach()
200+
201+
endif()
164202
endif()

ruby/openstudio_modeleditor.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ module WinAPI
5151
qt_dll_path = File.expand_path(File.join(File.dirname(__FILE__), '../bin/'))
5252

5353
# if install path fails, try developer paths
54-
if !File.exists?(File.join(qt_dll_path, 'Qt5Core.dll'))
54+
if !File.exist?(File.join(qt_dll_path, 'Qt6Core.dll'))
5555
release_dll_path = File.expand_path(File.join(File.dirname(__FILE__), '../../Release/'))
5656
debug_dll_path = File.expand_path(File.join(File.dirname(__FILE__), '../../Debug/'))
57-
if File.exists?(File.join(release_dll_path, 'Qt5Core.dll'))
57+
if File.exist?(File.join(release_dll_path, 'Qt6Core.dll'))
5858
qt_dll_path = release_dll_path
59-
elsif File.exists?(File.join(debug_dll_path, 'Qt5Core.dll'))
59+
elsif File.exist?(File.join(debug_dll_path, 'Qt6Core.dll'))
6060
qt_dll_path = debug_dll_path
6161
end
6262
end

ruby/test/PathWatcher_Test.rb

+2-36
Original file line numberDiff line numberDiff line change
@@ -116,42 +116,8 @@ def test_watchDir
116116
p = OpenStudio::Path.new("./")
117117
assert(OpenStudio::exists(p))
118118

119-
filePath = OpenStudio::Path.new("./path_watcher_dir")
120-
if OpenStudio::exists(filePath)
121-
OpenStudio::remove(filePath)
122-
end
123-
assert((not OpenStudio::exists(filePath)))
124-
125-
watcher = TestPathWatcher.new(p)
126-
assert((not watcher.changed))
127-
128-
filePath = OpenStudio::Path.new("./path_watcher_dir")
129-
File.open(filePath.to_s, 'w') do |f|
130-
f << "test 1"
131-
begin
132-
f.fsync
133-
rescue
134-
f.flush
135-
end
136-
end
137-
assert(OpenStudio::exists(filePath))
138-
139-
# calls processEvents
140-
OpenStudio::System::msleep(10000)
141-
OpenStudio::Modeleditor::Application::instance().processEvents(10000)
142-
143-
assert(watcher.changed)
144-
watcher.changed = false
145-
assert((not watcher.changed))
146-
147-
OpenStudio::remove(filePath)
148-
assert((not OpenStudio::exists(filePath)))
149-
150-
# calls processEvents
151-
OpenStudio::System::msleep(10000)
152-
OpenStudio::Modeleditor::Application::instance().processEvents(10000)
153-
154-
assert(watcher.changed)
119+
# try existent dir
120+
assert_raises(RuntimeError){TestPathWatcher.new(OpenStudio::Path.new(p))}
155121

156122
# try non-existent dir
157123
assert_raises(RuntimeError){TestPathWatcher.new(OpenStudio::Path.new("./I do not exist/"))}

0 commit comments

Comments
 (0)