mirror-chatterino2/tests/CMakeLists.txt
pajlada 9b31246502
feat: allow timeout-related commands to be used in multiple channels (#5402)
This changes the behaviour of the following commands:
 - `/ban`
 - `/timeout`
 - `/untimeout`
 - `/unban`

All of those commands now accept one or more `--channel` parameters to override which channel the action should take place in.
The `--channel` parameter accepts a channel ID or channel name with the same syntax as the other "user targets" do (e.g. `id:11148817` or `pajlada`)

examples
Ban user in the chat you're typing in:  
`/ban weeb123`

Ban user in the chat you're typing in, with a reason specified:  
`/ban weeb123 the ban reason`

Ban user in a separate chat, with a reason specified:  
`/ban --channel pajlada weeb123 the ban reason`

Ban user in two separate chats, with a reason specified:  
`/ban --channel pajlada --channel id:117166826 weeb123 the ban reason`


Timeout user in the chat you're typing in:  
`/timeout weeb123`

Timeout user in the chat you're typing in, with a reason specified:  
`/timeout weeb123 10m the timeout reason`

Timeout user in a separate chat, with a reason specified:  
`/timeout --channel pajlada weeb123 10m the timeout reason`

Timeout user in two separate chats, with a reason specified:  
`/timeout --channel pajlada --channel id:117166826 weeb123 10m the timeout reason`


Unban user in the chat you're typing in:  
`/unban weeb123`

Unban user in a separate chat:  
`/unban --channel pajlada weeb123`

Unban user in two separate chats:  
`/unban --channel pajlada --channel id:117166826 weeb123`
2024-06-16 12:22:51 +02:00

92 lines
3.5 KiB
CMake

project(chatterino-test)
option(CHATTERINO_TEST_USE_PUBLIC_HTTPBIN "Use public httpbin for testing network requests" OFF)
set(test_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/main.cpp
${CMAKE_CURRENT_LIST_DIR}/resources/test-resources.qrc
${CMAKE_CURRENT_LIST_DIR}/src/Test.hpp
${CMAKE_CURRENT_LIST_DIR}/src/Test.cpp
${CMAKE_CURRENT_LIST_DIR}/src/ChannelChatters.cpp
${CMAKE_CURRENT_LIST_DIR}/src/AccessGuard.cpp
${CMAKE_CURRENT_LIST_DIR}/src/NetworkCommon.cpp
${CMAKE_CURRENT_LIST_DIR}/src/NetworkRequest.cpp
${CMAKE_CURRENT_LIST_DIR}/src/NetworkResult.cpp
${CMAKE_CURRENT_LIST_DIR}/src/ChatterSet.cpp
${CMAKE_CURRENT_LIST_DIR}/src/HighlightPhrase.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Emojis.cpp
${CMAKE_CURRENT_LIST_DIR}/src/ExponentialBackoff.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Helpers.cpp
${CMAKE_CURRENT_LIST_DIR}/src/RatelimitBucket.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Hotkeys.cpp
${CMAKE_CURRENT_LIST_DIR}/src/UtilTwitch.cpp
${CMAKE_CURRENT_LIST_DIR}/src/IrcHelpers.cpp
${CMAKE_CURRENT_LIST_DIR}/src/TwitchPubSubClient.cpp
${CMAKE_CURRENT_LIST_DIR}/src/TwitchMessageBuilder.cpp
${CMAKE_CURRENT_LIST_DIR}/src/HighlightController.cpp
${CMAKE_CURRENT_LIST_DIR}/src/FormatTime.cpp
${CMAKE_CURRENT_LIST_DIR}/src/LimitedQueue.cpp
${CMAKE_CURRENT_LIST_DIR}/src/BasicPubSub.cpp
${CMAKE_CURRENT_LIST_DIR}/src/SeventvEventAPI.cpp
${CMAKE_CURRENT_LIST_DIR}/src/BttvLiveUpdates.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Updates.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Filters.cpp
${CMAKE_CURRENT_LIST_DIR}/src/LinkParser.cpp
${CMAKE_CURRENT_LIST_DIR}/src/InputCompletion.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Literals.cpp
${CMAKE_CURRENT_LIST_DIR}/src/XDGDesktopFile.cpp
${CMAKE_CURRENT_LIST_DIR}/src/XDGHelper.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Selection.cpp
${CMAKE_CURRENT_LIST_DIR}/src/NotebookTab.cpp
${CMAKE_CURRENT_LIST_DIR}/src/SplitInput.cpp
${CMAKE_CURRENT_LIST_DIR}/src/LinkInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/src/MessageLayout.cpp
${CMAKE_CURRENT_LIST_DIR}/src/QMagicEnum.cpp
${CMAKE_CURRENT_LIST_DIR}/src/ModerationAction.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Scrollbar.cpp
${CMAKE_CURRENT_LIST_DIR}/src/Commands.cpp
# Add your new file above this line!
)
add_executable(${PROJECT_NAME} ${test_SOURCES})
add_sanitizers(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-lib)
target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-mocks)
target_link_libraries(${PROJECT_NAME} PRIVATE gtest gmock)
set_target_properties(${PROJECT_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
)
if(CHATTERINO_ENABLE_LTO)
message(STATUS "Enabling LTO for ${PROJECT_NAME}")
set_property(TARGET ${PROJECT_NAME}
PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(CHATTERINO_TEST_USE_PUBLIC_HTTPBIN)
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_TEST_USE_PUBLIC_HTTPBIN)
endif()
set_target_properties(${PROJECT_NAME}
PROPERTIES
AUTORCC ON
)
if (CHATTERINO_STATIC_QT_BUILD)
qt_import_plugins(${PROJECT_NAME} INCLUDE_BY_TYPE
platforms Qt::QXcbIntegrationPlugin
Qt::QMinimalIntegrationPlugin
)
endif ()
gtest_discover_tests(${PROJECT_NAME})