Skip to content

Commit

Permalink
Merge pull request #783 from openstudiocoalition/develop
Browse files Browse the repository at this point in the history
PR to create 1.9.0-RC1
  • Loading branch information
macumber authored Jan 12, 2025
2 parents deabd36 + c3e8c04 commit 898f15e
Show file tree
Hide file tree
Showing 52 changed files with 7,487 additions and 5,247 deletions.
47 changes: 8 additions & 39 deletions .github/workflows/app_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,8 @@ jobs:
# fail-fast: Default is true, switch to false to allow one platform to fail and still run others
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2022, macos-13, macos-arm64]
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, macos-13, macos-arm64]
include:
- os: ubuntu-20.04
SELF_HOSTED: false
PLATFORM_NAME: Linux
BINARY_EXT: deb
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Linux/DEB
COMPRESSED_PKG_PATH: _CPack_Packages/Linux/TGZ
QT_OS_NAME: linux
QT_ARCH: gcc_64
arch: x86_64
- os: ubuntu-22.04
SELF_HOSTED: false
PLATFORM_NAME: Linux
Expand Down Expand Up @@ -81,8 +71,8 @@ jobs:
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 11.0
SDKROOT: /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
MACOSX_DEPLOYMENT_TARGET: 13.0
SDKROOT: /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: clang_64
arch: x86_64
Expand All @@ -93,8 +83,8 @@ jobs:
COMPRESSED_EXT: tar.gz
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 12.1
SDKROOT: /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
MACOSX_DEPLOYMENT_TARGET: 13.0
SDKROOT: /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: arm_64
arch: arm64
Expand All @@ -106,7 +96,7 @@ jobs:
- uses: actions/setup-python@v5
if: ${{ !matrix.SELF_HOSTED }}
with:
python-version: '3.8.x'
python-version: '3.12.x'

- uses: ruby/setup-ruby@v1
if: ${{ !matrix.SELF_HOSTED }}
Expand Down Expand Up @@ -194,7 +184,7 @@ jobs:
echo "/Users/irvinemac/Qt/Tools/QtInstallerFramework/4.3/bin/" >> $GITHUB_PATH
else
echo "Setting Xcode version"
sudo xcode-select -s "/Applications/Xcode_15.0.1.app/Contents/Developer/"
sudo xcode-select -s "/Applications/Xcode_15.2.app/Contents/Developer/"
echo "Using brew to install ninja"
brew install ninja md5sha1sum ccache
Expand Down Expand Up @@ -435,7 +425,7 @@ jobs:
echo "Qt $QT_VERSION already installed"
else
echo "Install aqtinstall, then install Qt $QT_VERSION for ${{ matrix.QT_OS_NAME }} ${{ matrix.QT_ARCH }}"
pip show setuptools
pip show setuptools || true
pip install setuptools --upgrade
pip3 install aqtinstall
aqt install-qt --outputdir ./build/Qt-install/ ${{ matrix.QT_OS_NAME }} desktop $QT_VERSION ${{ matrix.QT_ARCH }} -m qtwebchannel qtwebengine qtwebview qt5compat qtpositioning qtcharts
Expand Down Expand Up @@ -517,27 +507,6 @@ jobs:
conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release
fi
if [ "${{ matrix.SELF_HOSTED }}" == "true" ]; then
# TODO: temp... this is unfortunate but the OS SDK arm64 rc2 package has a different sha when extracted...
# OpenStudio-3.8.0-rc2+af997f4fef-Darwin-x86_64.tar.gz on github, but when extracted it's OpenStudio-3.8.0-rc2+06d9d975e1-Darwin-arm64
cmake --preset conan-release -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} \
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} \
-DBUILD_PACKAGE:BOOL=${{ env.BUILD_PACKAGE }} \
-DCPACK_BINARY_TGZ:BOOL=ON \
-DANALYTICS_API_SECRET:STRING=${{ secrets.ANALYTICS_API_SECRET }} \
-DANALYTICS_MEASUREMENT_ID:STRING=${{ secrets.ANALYTICS_MEASUREMENT_ID }} || true
ls $(pwd)/build/OpenStudio-3.8.0 || true
OS_DIR=$(find "$(pwd)/build/OpenStudio-3.8.0" -name openstudioConfig.cmake)
OS_DIR=$(dirname $OS_DIR)
cmake --preset conan-release -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} \
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} \
-DBUILD_PACKAGE:BOOL=${{ env.BUILD_PACKAGE }} \
-DCPACK_BINARY_TGZ:BOOL=ON \
-DANALYTICS_API_SECRET:STRING=${{ secrets.ANALYTICS_API_SECRET }} \
-DANALYTICS_MEASUREMENT_ID:STRING=${{ secrets.ANALYTICS_MEASUREMENT_ID }} -Dopenstudio_DIR:PATH=$OS_DIR
fi
if [ "$RUNNER_OS" == "macOS" ]; then
cmake --preset conan-release -DQT_INSTALL_DIR:PATH=${{ env.QT_INSTALL_DIR }} \
-DBUILD_DOCUMENTATION:BOOL=${{ env.BUILD_DOCUMENTATION }} \
Expand Down
10 changes: 5 additions & 5 deletions CMake/install_codesign_script_OpenStudioApp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ endif()

set(FILES_TO_SIGN
EnergyPlus/ExpandObjects
EnergyPlus/energyplus-24.1.0
EnergyPlus/energyplus-24.2.0
EnergyPlus/energyplus.1
EnergyPlus/libenergyplusapi.24.1.0.dylib
EnergyPlus/libenergyplusapi.24.2.0.dylib
EnergyPlus/libintl.8.dylib
EnergyPlus/libpython3.8.dylib
EnergyPlus/libpython3.12.dylib
Ruby/openstudio.bundle

Radiance/bin/vinfo
Expand Down Expand Up @@ -284,8 +284,8 @@ foreach(path ${FILES_TO_SIGN})
list(APPEND _FULL_PATHS "${CMAKE_INSTALL_PREFIX}/${path}")
endforeach()

file(GLOB_RECURSE _PYTHON_SOS "${CMAKE_INSTALL_PREFIX}/EnergyPlus/python_standard_lib/**/*.so")
file(GLOB _numpy_dylibs "${CMAKE_INSTALL_PREFIX}/EnergyPlus/python_standard_lib/numpy/.dylibs/*.dylib")
file(GLOB_RECURSE _PYTHON_SOS "${CMAKE_INSTALL_PREFIX}/EnergyPlus/python_lib/**/*.so")
file(GLOB _numpy_dylibs "${CMAKE_INSTALL_PREFIX}/EnergyPlus/python_lib/numpy/.dylibs/*.dylib")
list (APPEND _PYTHON_SOS ${_numpy_dylibs})

print_relative_paths(PREFIX "FULL_PATHS=" ABSOLUTE_PATHS ${_FULL_PATHS})
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE FILEPATH "C compiler cache used")
endif()

project(OpenStudioApplication VERSION 1.8.0)
project(OpenStudioApplication VERSION 1.9.0)

# Check system info globally so we can use it everywhere after: Has to be done before FindOpenStudioSDK.cmake
if(APPLE)
Expand Down Expand Up @@ -272,7 +272,7 @@ endif()

# TODO: Modify the more specific variables as needed to indicate prerelease, etc
# Keep in beta in-between release cycles. Set to empty string (or comment out) for official)
set(PROJECT_VERSION_PRERELEASE "")
set(PROJECT_VERSION_PRERELEASE "rc1")

# OpenStudio version: Only include Major.Minor.Patch, eg "3.0.0", even if you have a prerelease tag
set(OPENSTUDIOAPPLICATION_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
Expand Down Expand Up @@ -798,7 +798,7 @@ install(IMPORTED_RUNTIME_ARTIFACTS openstudio::pythonengine DESTINATION ${LIB_DE

# TODO: we should probably just install the **entire** OS SDK bin/ directory...
if(WIN32)
install(PROGRAMS $<$<CONFIG:Debug>:${openstudio_ROOT_DIR}/bin/python38_d.dll>$<$<CONFIG:Release>:${openstudio_ROOT_DIR}/bin/python38.dll>$<$<CONFIG:RelWithDebInfo>:${openstudio_ROOT_DIR}/bin/python38.dll>$<$<CONFIG:MinSizeRel>:${openstudio_ROOT_DIR}/bin/python38.dll> DESTINATION bin COMPONENT "CLI")
install(PROGRAMS $<$<CONFIG:Debug>:${openstudio_ROOT_DIR}/bin/python312_d.dll>$<$<CONFIG:Release>:${openstudio_ROOT_DIR}/bin/python312.dll>$<$<CONFIG:RelWithDebInfo>:${openstudio_ROOT_DIR}/bin/python312.dll>$<$<CONFIG:MinSizeRel>:${openstudio_ROOT_DIR}/bin/python312.dll> DESTINATION bin COMPONENT "CLI")
endif()

# install(PROGRAMS ${OS_CLI_IMPORTED_PATH} DESTINATION bin COMPONENT "CLI" RENAME "${OS_CLI_IMPORTED_NAME}")
Expand Down Expand Up @@ -863,7 +863,7 @@ elseif(UNIX)
# set(CPACK_DEBIAN_PACKAGE_DEBUG ON)

# Focal Fossa (20.04) uses libwxgtk3.0-gtk3-0v5, apparently need libxcb-xinerama0 as well
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libxcb-xinerama0 (>= 1.13), libwxgtk3.0-0v5 (>= 3.0.0) | libwxgtk3.0-0 (>=3.0.0) | libwxgtk3.0-gtk3-0v5 (>=3.0.0) | libwxgtk3.2-1t64 (>= 3.2.0), libxcb-cursor0")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libxcb-xinerama0 (>= 1.13), libwxgtk3.0-0v5 (>= 3.0.0) | libwxgtk3.0-0 (>=3.0.0) | libwxgtk3.0-gtk3-0v5 (>=3.0.0) | libwxgtk3.2-1t64 (>= 3.2.0) | libwxgtk3.2-1 (>= 3.2.0), libxcb-cursor0")

# These two will set the .deb install path correctly
set(CPACK_SET_DESTDIR ON)
Expand Down
24 changes: 11 additions & 13 deletions FindOpenStudioSDK.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
set(OPENSTUDIO_VERSION_MAJOR 3)
set(OPENSTUDIO_VERSION_MINOR 8)
set(OPENSTUDIO_VERSION_MINOR 9)
set(OPENSTUDIO_VERSION_PATCH 0)
set(OPENSTUDIO_VERSION "${OPENSTUDIO_VERSION_MAJOR}.${OPENSTUDIO_VERSION_MINOR}.${OPENSTUDIO_VERSION_PATCH}")

#If this is an official release, leave this "", otherwise put for eg '-rc1'
set(OPENSTUDIO_VERSION_PRERELEASE "")
# Enter SHA, always, eg "+79857912c4"
set(OPENSTUDIO_VERSION_SHA "+f953b6fcaf")
set(OPENSTUDIO_VERSION_SHA "+c77fbb9569")

# Paths where the cmake-downloaded archives will be put
set(OPENSTUDIO_ARCHIVE_DIR "${PROJECT_BINARY_DIR}/OpenStudio-${OPENSTUDIO_VERSION}")
Expand All @@ -17,34 +17,32 @@ set(OPENSTUDIO_EXT "tar.gz")
if(APPLE)
set(OPENSTUDIO_PLATFORM "Darwin-${ARCH}")
if(ARCH MATCHES "arm64")
set(OPENSTUDIO_EXPECTED_HASH 0e983b1a7bd2eed2b27c866125e0716b)
set(OPENSTUDIO_EXPECTED_HASH b373b0f23b529f9764464aae13725558)
else()
set(OPENSTUDIO_EXPECTED_HASH 8be3effb0599888511958999774df569)
set(OPENSTUDIO_EXPECTED_HASH 39c5ae27eeb840472e36b728ab906315)
endif()

elseif(UNIX)
set(OPENSTUDIO_PLATFORM "${LSB_RELEASE_ID_SHORT}-${LSB_RELEASE_VERSION_SHORT}-${ARCH}")
if(LSB_RELEASE_VERSION_SHORT MATCHES "24.04")
set(OPENSTUDIO_PLATFORM "${LSB_RELEASE_ID_SHORT}-22.04-${ARCH}")
#set(OPENSTUDIO_PLATFORM "${LSB_RELEASE_ID_SHORT}-22.04-${ARCH}")
if (ARCH MATCHES "arm64")
set(OPENSTUDIO_EXPECTED_HASH ff544a9dfa4846de6af959a0c1ec926d)
set(OPENSTUDIO_EXPECTED_HASH 4c35af3cc4e8d7b1aed2dd98b678a243)
else()
set(OPENSTUDIO_EXPECTED_HASH b14c71b37a01040f3216abc68488ed62)
set(OPENSTUDIO_EXPECTED_HASH 256d18d2d7036883823f2aeae180dfaa)
endif()
elseif(LSB_RELEASE_VERSION_SHORT MATCHES "22.04")
if (ARCH MATCHES "arm64")
set(OPENSTUDIO_EXPECTED_HASH ff544a9dfa4846de6af959a0c1ec926d)
set(OPENSTUDIO_EXPECTED_HASH fd1ba05628eb55b3bb72923a8395e267)
else()
set(OPENSTUDIO_EXPECTED_HASH b14c71b37a01040f3216abc68488ed62)
set(OPENSTUDIO_EXPECTED_HASH 67522b9a1ba5749cf0b3cf101a6131cf)
endif()
elseif(LSB_RELEASE_VERSION_SHORT MATCHES "20.04")
set(OPENSTUDIO_EXPECTED_HASH 98539ab193b15a140146add5e089900c)
else()
message(FATAL_ERROR "OpenStudio SDK no longer provides packages for Ubuntu 18.04")
message(FATAL_ERROR "OpenStudio SDK no longer provides packages for Ubuntu 20.04 or older")
endif()

elseif(WIN32)
set(OPENSTUDIO_EXPECTED_HASH 26395d446a91a0042d3976cabd0fb5ab)
set(OPENSTUDIO_EXPECTED_HASH c3a1ec4bc98d7418780a702036ce0edb)
set(OPENSTUDIO_PLATFORM "Windows")
endif()

Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| | Build Status |
|-------------------------|--------------|
| master | [![C++ CI for OpenStudioApplication - master](https://github.com/openstudiocoalition/OpenStudioApplication/workflows/C++%20CI%20for%20OpenStudioApplication/badge.svg?branch=master)](https://github.com/openstudiocoalition/OpenStudioApplication/actions?query=branch%3Amaster)|
| develop | [![C++ CI for OpenStudioApplication - develop](https://github.com/openstudiocoalition/OpenStudioApplication/workflows/C++%20CI%20for%20OpenStudioApplication/badge.svg?branch=develop)](https://github.com/openstudiocoalition/OpenStudioApplication/actions?query=branch%3Adevelop) |
| master | [![C++ CI for OpenStudioApplication - master](https://github.com/openstudiocoalition/OpenStudioApplication/actions/workflows/app_build.yml/badge.svg?branch=master)](https://github.com/openstudiocoalition/OpenStudioApplication/actions/workflows/app_build.yml?query=branch%3Amaster)|
| develop | [![C++ CI for OpenStudioApplication - develop](https://github.com/openstudiocoalition/OpenStudioApplication/actions/workflows/app_build.yml/badge.svg?branch=develop)](https://github.com/openstudiocoalition/OpenStudioApplication/actions/workflows/app_build.yml?query=branch%3Adevelop)|


# Important!
Expand All @@ -13,7 +13,11 @@ For more information about the OpenStudio Coalition, including tutorials and doc

# OpenStudio Application

The **OpenStudio Application** is a fully featured graphical interface to OpenStudio models including envelope, loads, schedules, geometry, HVAC, and OpenStudio Measures. The **OpenStudio Application** is open source software and is free to use. The **OpenStudio Application** is built on top of the **[OpenStudio SDK](https://github.com/NREL/OpenStudio)**. The **OpenStudio Application** can be downloaded for Mac, Linux, and Windows on the [Releases page](https://github.com/openstudiocoalition/OpenStudioApplication/releases).
The **OpenStudio Application** is a fully featured graphical interface to OpenStudio models including envelope, loads, schedules, geometry, HVAC, and OpenStudio Measures. The **OpenStudio Application** is open source software and is free to use. The **OpenStudio Application** is built on top of the **[OpenStudio SDK](https://github.com/NREL/OpenStudio)**.

## Downloading the OpenStudio Application

The **OpenStudio Application** can be downloaded for Mac, Linux, and Windows by logging in at https://openstudiocoalition.org/app/

## What is the OpenStudio Software Development Kit (SDK)?

Expand Down
11 changes: 6 additions & 5 deletions ci/install_script_qtifw.qs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Controller.prototype.TargetDirectoryPageCallback = function()
};

// Unused
//Controller.prototype.ComponentSelectionPageCallback = function() {
//console.log("---- COMPONENT SELECTION PAGE");
//logCurrentPage();
Controller.prototype.ComponentSelectionPageCallback = function() {
console.log("---- COMPONENT SELECTION PAGE");
logCurrentPage();

//var widget = gui.currentPageWidget();

Expand Down Expand Up @@ -106,8 +106,8 @@ Controller.prototype.TargetDirectoryPageCallback = function()
//console.log("* " + compName + ": " + installStatus);
//}

//gui.clickButton(buttons.NextButton);
//};
gui.clickButton(buttons.NextButton);
};

Controller.prototype.LicenseAgreementPageCallback = function() {
console.log("---- LICENSE AGREEMENT PAGE");
Expand Down Expand Up @@ -153,6 +153,7 @@ Controller.prototype.PerformInstallationPageCallback = function()
Controller.prototype.FinishedPageCallback = function() {
console.log("---- FINISHED PAGE");
logCurrentPage();
gui.currentPageWidget().RunItCheckBox.setChecked(false);

gui.clickButton(buttons.FinishButton);
};
6 changes: 3 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def generate(self):
tc.cache_variables["CPACK_SOURCE_ZIP"] = False

v = sys.version_info
if (v.major, v.minor) == (3, 8):
if (v.major, v.minor) == (3, 12):
python_version = f"{v.major}.{v.minor}.{v.micro}"
self.output.info(
f"Setting PYTHON_VERSION and Python_ROOT_DIR from your current python: {python_version}, '{sys.base_prefix}'"
Expand All @@ -105,8 +105,8 @@ def generate(self):
tc.cache_variables["Python_ROOT_DIR"] = str(Path(sys.base_prefix))
else:
self.output.warning(
"Your current python is not in the 3.8.x range, which is what we target.\n"
"Your current python is not in the 3.12.x range, which is what we target.\n"
"You'll need to pass it properly when configuring CMake\n"
"via -DPYTHON_VERSION:STRING='3.8.xx' and -DPython_ROOT_DIR:PATH='/path/to/python3.8/'"
"via -DPYTHON_VERSION:STRING='3.12.xx' and -DPython_ROOT_DIR:PATH='/path/to/python3.8/'"
)
tc.generate()
12 changes: 4 additions & 8 deletions src/model_editor/InspectorGadget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,11 @@ void InspectorGadget::layoutComboBox(QVBoxLayout* layout, QWidget* parent, opens
int idx = combo->findText(curVal.c_str(), Qt::MatchFixedString);

if (-1 == idx) {

// field is currently set to an invalid value
idx = 0;
connect(combo, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged), this, &InspectorGadget::IGdefaultRemoved);
combo->insertItem(idx, QPixmap(":/images/alert_image.png"), curVal.c_str(), "Invalid");

//QString errormsg("We have a value:");
//errormsg += curVal.c_str();
//errormsg += " that does not match the allowable values in the idd.Name:";
Expand Down Expand Up @@ -887,13 +890,6 @@ void InspectorGadget::checkRemoveBtn(QPushButton* btn) {
}

//SLOTS
void InspectorGadget::IGdefaultRemoved(const QString& /*unused*/) {
QObject* source = sender();
auto* w = dynamic_cast<QWidget*>(source);
w->setStyleSheet("color:black");
// using old style disconnect here
disconnect(source, nullptr, this, SLOT(IGdefaultRemoved(const QString&)));
}

void InspectorGadget::IGvalueChanged(const QString& value) {
OS_ASSERT(m_workspaceObj);
Expand Down
10 changes: 0 additions & 10 deletions src/model_editor/InspectorGadget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,6 @@ class MODELEDITOR_API InspectorGadget
*/
void clear(bool recursive);

/*! \brief changes the color of widgets
*
* When widget are built, if the Field is required but there is no value and no default value
*(which in a way, is bad idf) the IG will put 0 or 0.0 in there for you, but color it red
* to point out that you should address this. Once you set a value, this function is automatically
* called for you and sets the color back to black.
*
*/
void IGdefaultRemoved(const QString&);

void IGvalueChanged(const QString&);

void IGcommentChanged(const QString&);
Expand Down
33 changes: 33 additions & 0 deletions src/model_editor/test/Utilities_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "../Utilities.hpp"

#include <clocale>
#include <QUrl>

using openstudio::toPath;
using openstudio::toQString;
Expand Down Expand Up @@ -113,3 +114,35 @@ TEST_F(ModelEditorFixture, Path_Conversions) {
EXPECT_EQ(t, std::string(toQString(toString(p)).toUtf8()));
EXPECT_EQ(t, toString(toPath(toQString(toString(p)))));
}

TEST_F(ModelEditorFixture, MorePath_Conversions) {
struct PathTestCase
{
std::string inputPath;
QString expectedPath;
QString expectedUrl;
};

std::vector<PathTestCase> testCases = {
{"C:\\Users\\Test\\eplustbl.html", "C:/Users/Test/eplustbl.html", "file:///C:/Users/Test/eplustbl.html"},
{"C:/Users/Test/eplustbl.html", "C:/Users/Test/eplustbl.html", "file:///C:/Users/Test/eplustbl.html"},
{"C:\\Users/Test/eplustbl.html", "C:/Users/Test/eplustbl.html", "file:///C:/Users/Test/eplustbl.html"},
{"C:\\Users\\Test# ^\\eplustbl.html", "C:/Users/Test# ^/eplustbl.html", "file:///C:/Users/Test%23%20%5E/eplustbl.html"},
{"/home/Test/eplustbl.html", "/home/Test/eplustbl.html", "file:///home/Test/eplustbl.html"},
{"/home/Test# ^/eplustbl.html", "/home/Test# ^/eplustbl.html", "file:///home/Test%23%20%5E/eplustbl.html"},
};

// double check the conversions in openstudio_lib/ResultsTabView.cpp
for (const auto& testCase : testCases) {
openstudio::path osPath = toPath(testCase.inputPath);
QString qPath = toQString(osPath);
EXPECT_EQ(qPath, testCase.expectedPath);
QUrl url = QUrl::fromLocalFile(qPath);
EXPECT_EQ(url.toString(QUrl::FullyEncoded), testCase.expectedUrl);

std::cout << "Input: " << testCase.inputPath << ", "
<< "OS Path: " << osPath << ", "
<< "QPath: " << qPath.toStdString() << ", "
<< "Url: " << url.toString().toStdString() << std::endl;
}
}
Loading

0 comments on commit 898f15e

Please sign in to comment.