Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41c6ddf5b9 | |||
| 70ebe53335 | |||
| 6d0340b310 | |||
| b491d901a1 |
@@ -106,6 +106,7 @@
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\Arg\ConnectorConfig.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\ConfigBridge.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\GetConfig.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\GetIsDevMode.cpp"/>
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\UpdateConfig.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\SendBridge.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\Arg\SayHiArg.cpp" />
|
||||
@@ -134,6 +135,7 @@
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\Arg\ConnectorConfig.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\ConfigBridge.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\GetConfig.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\GetIsDevMode.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\UpdateConfig.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\SendBridge.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\Arg\SayHiArg.h" />
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
21B67CF12C78D38000FD64FC /* GoAway.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21B67CF02C78D38000FD64FC /* GoAway.cpp */; };
|
||||
21B67CF72C78D4DE00FD64FC /* GetComplexType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21B67CF52C78D4DD00FD64FC /* GetComplexType.cpp */; };
|
||||
21D0BD602C89BFEA0077E104 /* SendBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD5B2C89BFEA0077E104 /* SendBridge.cpp */; };
|
||||
21D0BD672C89D7410077E104 /* AccountTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD642C89D7400077E104 /* AccountTests.cpp */; };
|
||||
21D1E9AD2BF14AF200957EAA /* BIMData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D1E9152BF14AEC00957EAA /* BIMData.framework */; };
|
||||
21D1E9AE2BF14AF200957EAA /* TeamworkPortalServerClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D1E9162BF14AEC00957EAA /* TeamworkPortalServerClient.framework */; };
|
||||
21D1E9AF2BF14AF200957EAA /* GDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D1E9172BF14AEC00957EAA /* GDL.framework */; };
|
||||
@@ -307,6 +308,7 @@
|
||||
21B67CF62C78D4DE00FD64FC /* GetComplexType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetComplexType.h; sourceTree = "<group>"; };
|
||||
21D0BD5B2C89BFEA0077E104 /* SendBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SendBridge.cpp; sourceTree = "<group>"; };
|
||||
21D0BD5C2C89BFEA0077E104 /* SendBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SendBridge.h; sourceTree = "<group>"; };
|
||||
21D0BD642C89D7400077E104 /* AccountTests.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = AccountTests.cpp; sourceTree = "<group>"; };
|
||||
21D1E9152BF14AEC00957EAA /* BIMData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BIMData.framework; path = "../Archicad 27/Support/Frameworks/BIMData.framework"; sourceTree = "<group>"; };
|
||||
21D1E9162BF14AEC00957EAA /* TeamworkPortalServerClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TeamworkPortalServerClient.framework; path = "../Archicad 27/Support/Frameworks/TeamworkPortalServerClient.framework"; sourceTree = "<group>"; };
|
||||
21D1E9172BF14AEC00957EAA /* GDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GDL.framework; path = "../Archicad 27/Support/Frameworks/GDL.framework"; sourceTree = "<group>"; };
|
||||
@@ -874,6 +876,7 @@
|
||||
219F30412C769282009834E9 /* ConnectorTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21D0BD642C89D7400077E104 /* AccountTests.cpp */,
|
||||
219F30402C769282009834E9 /* ConfigTests.cpp */,
|
||||
219F30432C7693B6009834E9 /* Connector-AC27-Debug.xctestplan */,
|
||||
);
|
||||
@@ -1325,6 +1328,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
219F30422C769283009834E9 /* ConfigTests.cpp in Sources */,
|
||||
21D0BD672C89D7410077E104 /* AccountTests.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Connector/Interface/Browser/Bridge/Config/GetConfig.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Config/UpdateConfig.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Config/GetIsDevMode.h"
|
||||
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
|
||||
@@ -12,4 +13,5 @@ ConfigBridge::ConfigBridge() : BrowserBridge{"configBinding"} {
|
||||
//Add bridge methods
|
||||
addMethod<GetConfig>();
|
||||
addMethod<UpdateConfig>();
|
||||
addMethod<GetIsDevMode>();
|
||||
} //ConfigBridge::ConfigBridge
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
GetConfig();
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Config/GetIsDevMode.h"
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
///Return type for retrieving the current configuration
|
||||
using WrappedValue = CargoHold<ValueWrap<bool>, bool>;
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
GetIsDevMode::GetIsDevMode() : BridgeMethod{"GetIsDevMode", [&]() {
|
||||
return run();
|
||||
}} {}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the DEBUG mode
|
||||
|
||||
return: true for DEBUG, false otherwise
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetIsDevMode::run() const {
|
||||
|
||||
#if DEBUG
|
||||
bool value = true;
|
||||
#else
|
||||
bool value = false;
|
||||
#endif
|
||||
|
||||
return std::make_unique<WrappedValue>(value);
|
||||
} //GetIsDevMode::run
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_GET_IS_DEV_MODE
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_GET_IS_DEV_MODE
|
||||
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve IsDebugMode
|
||||
*/
|
||||
class GetIsDevMode : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
*/
|
||||
GetIsDevMode();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the DEBUG mode
|
||||
@return true for DEBUG, false otherwise
|
||||
*/
|
||||
std::unique_ptr<active::serialise::Cargo> run() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_GET_IS_DEV_MODE
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "ActiveLibDoctest/TestingPlatforms.h"
|
||||
|
||||
#include "Active/Serialise/JSON/JSONTransport.h"
|
||||
#include "Active/Serialise/Package/PackageWrap.h"
|
||||
#include "Active/Utility/BufferIn.h"
|
||||
#include "Speckle/Record/Credentials/Account.h"
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace active::serialise::json;
|
||||
using namespace active::serialise::json;
|
||||
using namespace speckle::record::cred;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
const char* accountJSON = "{\"id\":\"194B6E32061EB588B31D8CBC167DAAD8\",\"token\":\"547e30bcd0f0e377fe422019f388295e37c583a99f\",\"refreshToken\":\"7d23031b44856e768b5951161c9bc8378f663eefce\",\"isDefault\":false,\"isOnline\":false,\"serverInfo\":{\"name\":\"My new Speckle Server\",\"company\":\"Unknown Company\",\"version\":\"2.20.2-branch.testing.138676-e8c8291\",\"adminContact\":\"n/a\",\"description\":\"This a community deployment of a Speckle Server.\",\"frontend2\":true,\"url\":\"https://testing.speckle.dev\",\"migration\":null},\"userInfo\":{\"id\":\"e66694013f\",\"name\":\"oguzhan@speckle.systems\",\"email\":\"oguzhan@speckle.systems\",\"company\":null,\"avatar\":null,\"streams\":{\"totalCount\":2},\"commits\":{\"totalCount\":5}}}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST_SUITE(TESTQ(AccountTests)) TEST_SUITE_OPEN
|
||||
|
||||
//Test to receive account serialised as JSON from SQLite dbase
|
||||
TEST_CASE(TESTQ(testAccountReceive)) {
|
||||
Account account;
|
||||
try {
|
||||
JSONTransport().receive(PackageWrap{account}, Identity{}, String{accountJSON});
|
||||
} catch(...) {
|
||||
FAIL_CHECK(TEST_MESSAGE(Account deserialisation failed));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_SUITE_CLOSE
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "ActiveLibDoctest/TestingPlatforms.h"
|
||||
|
||||
#include "Speckle/Utility/Guid32.h"
|
||||
|
||||
using namespace speckle::utility;
|
||||
|
||||
TEST_SUITE(TESTQ(GuidTests)) TEST_SUITE_OPEN
|
||||
|
||||
///Tests for creating/modifying guids
|
||||
TEST_CASE(TESTQ(testGuidContent)) {
|
||||
Guid32 badGuid{String{"abcd"}};
|
||||
CHECK_MESSAGE(!badGuid, TEST_MESSAGE(Guid32 created from bad data));
|
||||
}
|
||||
|
||||
TEST_SUITE_CLOSE
|
||||
Reference in New Issue
Block a user