Merge branch 'main' into beta

This commit is contained in:
David Capello 2022-01-05 20:16:13 -03:00
commit 6e726025ee
24 changed files with 68 additions and 32 deletions

View File

@ -316,6 +316,8 @@ if(REQUIRE_CURL)
if(USE_SHARED_CURL)
find_package(CURL REQUIRED)
else()
set(CURL_FOUND 1)
set(CURL_LIBRARY libcurl)
set(CURL_LIBRARIES libcurl)
set(CURL_INCLUDE_DIRS ${CURL_DIR}/include)
endif()
@ -328,9 +330,6 @@ include_directories(${SIMPLEINI_DIR})
# Third parties
add_subdirectory(third_party)
# LAF libraries + Aseprite are compiled with config.h
include_directories(src)
add_definitions(-DHAVE_CONFIG_H)
if(ENABLE_MEMLEAK)
add_definitions(-DLAF_MEMLEAK)
endif()
@ -339,6 +338,11 @@ set(LAF_WITH_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable LAF tests")
set(UNDO_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
add_subdirectory(laf)
# LAF libraries + Aseprite are compiled with config.h
target_include_directories(laf-base PUBLIC src)
target_compile_definitions(laf-base PUBLIC HAVE_CONFIG_H)
add_subdirectory(src)
######################################################################

View File

@ -1,3 +1,4 @@
# Copyright (C) 2021 Igara Studio S.A.
# Copyright (C) 2001-2016 David Capello
# Find tests and add rules to compile them and run them
@ -5,9 +6,6 @@ function(find_tests dir dependencies)
file(GLOB tests ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*_tests.cpp)
list(REMOVE_AT ARGV 0)
# Add gtest include directory so we can #include <gtest/gtest.h> in tests source code
include_directories(${CMAKE_SOURCE_DIR}/third_party/gtest/include)
# See if the test is linked with "laf-os" library.
list(FIND dependencies laf-os link_with_os)
if(link_with_os)
@ -28,6 +26,13 @@ function(find_tests dir dependencies)
target_link_libraries(${testname} gtest ${ARGV} ${PLATFORM_LIBS})
target_include_directories(${testname} PUBLIC
# So we can include "tests/app_test.h"
${CMAKE_SOURCE_DIR}/src
# Add gtest include directory so we can #include <gtest/gtest.h>
# in tests source code
${CMAKE_SOURCE_DIR}/third_party/gtest/include)
if(extra_definitions)
set_target_properties(${testname}
PROPERTIES COMPILE_FLAGS ${extra_definitions})

2
laf

@ -1 +1 @@
Subproject commit e1d2d23413e9028bfa6f0b08b74d9c57b3eed4a6
Subproject commit 56b72b6b03f8411115c4bd201b6896340eee08e1

View File

@ -5,7 +5,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/cli/app_options.h"
#include "app/cli/cli_processor.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/cli/cli_processor.h"
#include "doc/layer.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/color.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/context.h"
#include "app/doc.h"

View File

@ -5,7 +5,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/context.h"
#include "app/doc.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/context.h"
#include "app/doc.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include <errno.h>
#include "base/thread.h"

View File

@ -5,7 +5,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/app.h"
#include "app/context.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/file/split_filename.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/filename_formatter.h"

View File

@ -4,7 +4,7 @@
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#include "tests/test.h"
#include "tests/app_test.h"
#include "app/ini_file.h"
#include "base/fs.h"

View File

@ -135,10 +135,12 @@ int App_transaction(lua_State* L)
int nresults = 0;
if (lua_isfunction(L, 1)) {
Tx tx; // Create a new transaction so it exists in the whole
// duration of the argument function call.
// duration of the argument function call.
lua_pushvalue(L, -1);
if (lua_pcall(L, 0, LUA_MULTRET, 0) == LUA_OK)
tx.commit();
else
return lua_error(L); // pcall already put an error object on the stack
nresults = lua_gettop(L) - top;
}
return nresults;

View File

@ -127,6 +127,11 @@ int WebSocket_gc(lua_State* L)
int WebSocket_sendText(lua_State* L)
{
auto ws = get_ptr<ix::WebSocket>(L, 1);
if (ws->getReadyState() != ix::ReadyState::Open) {
return luaL_error(L, "WebSocket is not connected, can't send text");
}
std::stringstream data;
int argc = lua_gettop(L);
@ -137,8 +142,7 @@ int WebSocket_sendText(lua_State* L)
}
if (!ws->sendText(data.str()).success) {
lua_pushstring(L, "Websocket error");
lua_error(L);
return luaL_error(L, "WebSocket failed to send text");
}
return 0;
}
@ -146,6 +150,11 @@ int WebSocket_sendText(lua_State* L)
int WebSocket_sendBinary(lua_State* L)
{
auto ws = get_ptr<ix::WebSocket>(L, 1);
if (ws->getReadyState() != ix::ReadyState::Open) {
return luaL_error(L, "WebSocket is not connected, can't send data");
}
std::stringstream data;
int argc = lua_gettop(L);
@ -156,8 +165,7 @@ int WebSocket_sendBinary(lua_State* L)
}
if (!ws->sendBinary(data.str()).success) {
lua_pushstring(L, "Websocket error");
lua_error(L);
return luaL_error(L, "WebSocket failed to send data");
}
return 0;
}
@ -165,13 +173,17 @@ int WebSocket_sendBinary(lua_State* L)
int WebSocket_sendPing(lua_State* L)
{
auto ws = get_ptr<ix::WebSocket>(L, 1);
if (ws->getReadyState() != ix::ReadyState::Open) {
return luaL_error(L, "WebSocket is not connected, can't send ping");
}
size_t bufLen;
const char* buf = lua_tolstring(L, 2, &bufLen);
std::string data(buf, bufLen);
if (!ws->ping(data).success) {
lua_pushstring(L, "Websocket error");
lua_error(L);
return luaL_error(L, "WebSocket failed to send ping");
}
return 0;
}

View File

@ -97,13 +97,26 @@ bool Sentry::areThereCrashesToReport()
void Sentry::setupDirs(sentry_options_t* options)
{
// The expected handler executable name is aseprite_crashpad_handler (.exe)
const std::string handler =
base::join_path(base::get_file_path(base::get_app_path()),
"aseprite_crashpad_handler"
#if LAF_WINDOWS
".exe"
#endif
);
// The crash database will be located in the user directory as the
// "crashdb" directory (along with "sessions", "extensions", etc.)
ResourceFinder rf;
rf.includeUserDir("crashdb");
const std::string dir = rf.getFirstOrCreateDefault();
#if SENTRY_PLATFORM_WINDOWS
#if LAF_WINDOWS
sentry_options_set_handler_pathw(options, base::from_utf8(handler).c_str());
sentry_options_set_database_pathw(options, base::from_utf8(dir).c_str());
#else
sentry_options_set_handler_path(options, handler.c_str());
sentry_options_set_database_path(options, dir.c_str());
#endif

@ -1 +1 @@
Subproject commit a65a9e543e9a270bb7c58789d15d027bbd8efb2a
Subproject commit c46c49141f72dd753b260eea4e6d7b37413f0ff6

@ -1 +1 @@
Subproject commit bddbeed8b94d2639fa945bdf14a90d7afbd58506
Subproject commit 8e03c3cb060120b25517503e6c1d9072686d1cd3

View File

@ -5,7 +5,7 @@
// Read LICENSE.txt for more information.
#define TEST_GUI
#include "tests/test.h"
#include "tests/app_test.h"
using namespace ui;

View File

@ -5,7 +5,7 @@
// Read LICENSE.txt for more information.
#define TEST_GUI
#include "tests/test.h"
#include "tests/app_test.h"
#include "gfx/rect_io.h"
#include "gfx/size.h"

@ -1 +1 @@
Subproject commit e72730478aa6d4dc3be0c914058a7e0561aabe1e
Subproject commit 3cf8f20d08bf38b06b8e0e75757a18e31ddb12d9

View File

@ -15,4 +15,4 @@ endif()
add_library(ver-lib info.c ${gen_ver_fn})
add_dependencies(ver-lib generated_version_h)
target_include_directories(ver-lib PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
target_include_directories(ver-lib PRIVATE .. "${CMAKE_CURRENT_BINARY_DIR}")