reorganize tests

This commit is contained in:
Akash Mozumdar 2019-06-10 22:23:06 -04:00
parent c5a6e16488
commit 516881d409
8 changed files with 14 additions and 18 deletions

View File

@ -36,4 +36,4 @@ add_subdirectory(GUI)
add_subdirectory(GUI/host)
add_subdirectory(texthook)
add_subdirectory(extensions)
add_subdirectory(testbed)
add_subdirectory(test)

View File

@ -15,8 +15,6 @@ add_library(Remove\ Repetition MODULE removerepeat.cpp extensionimpl.cpp)
add_library(Replacer MODULE replacer.cpp extensionimpl.cpp)
add_library(Thread\ Linker MODULE threadlinker.cpp extensionimpl.cpp)
add_executable(Extension_Tests extensiontester.cpp)
target_link_libraries(Bing\ Translate winhttp Qt5::Widgets)
target_link_libraries(Extra\ Window Qt5::Widgets)
target_link_libraries(Google\ Translate winhttp Qt5::Widgets)

View File

@ -1,12 +0,0 @@
#include "common.h"
#include <filesystem>
int main()
{
wchar_t path[MAX_PATH] = {};
GetModuleFileNameW(NULL, path, MAX_PATH);
*(wcsrchr(path, L'\\') + 1) = 0;
for (auto file : std::filesystem::directory_iterator(path))
if (file.path().extension() == L".dll") LoadLibraryW(file.path().c_str());
Sleep(10000);
}

1
test/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_executable(Test WIN32 main.cpp resource.rc)

View File

@ -1,13 +1,19 @@
#include "common.h"
#include "defs.h"
#include "resource.h"
#include <filesystem>
#include <fstream>
#include <sstream>
wchar_t buffer[1000] = {};
std::array<int, 10> vars = {};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
LoadLibraryW(ITH_DLL);
for (auto file : std::filesystem::directory_iterator(std::filesystem::current_path()))
if (file.path().extension() == L".dll"
&& (std::stringstream() << std::ifstream(file.path(), std::ios::binary).rdbuf()).str().find("OnNewSentence") != std::string::npos)
LoadLibraryW(file.path().c_str());
ShowWindow(CreateDialogParamW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG1), NULL, [](HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -> INT_PTR
{
@ -37,7 +43,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
return FALSE;
}, 0), SW_SHOW);
std::thread([] { while (true) lstrlenW(L"こんにちは"); }).detach();
std::thread([] { while (true) Sleep(vars.at(0)), lstrlenW(L"こんにちは"); }).detach();
STARTUPINFOW info = { sizeof(info) };
wchar_t commandLine[] = { L"Textractor -p\"Test.exe\"" };
CreateProcessW(NULL, commandLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &info, DUMMY);
MSG msg;
while (GetMessageW(&msg, NULL, 0, 0) > 0)

View File

@ -1 +0,0 @@
add_executable(Testbed WIN32 main.cpp resource.rc)