-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted test framework to use vortexlib
- Loading branch information
1 parent
9def1a3
commit 7d056db
Showing
33 changed files
with
2,444 additions
and
2,749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include "EditorPipe.h" | ||
#include "TestFramework.h" | ||
|
||
HANDLE EditorPipe::hPipe = nullptr; | ||
bool EditorPipe::m_serialConnected = false; | ||
|
||
bool EditorPipe::init() | ||
{ | ||
// create a global pipe | ||
hPipe = CreateNamedPipe( | ||
"\\\\.\\pipe\\vortextestframework", | ||
PIPE_ACCESS_DUPLEX, | ||
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, | ||
1, | ||
4096, | ||
4096, | ||
0, | ||
NULL); | ||
if (hPipe == INVALID_HANDLE_VALUE) { | ||
// this will happen if two test frameworks are launched | ||
// maybe there's a better way around it idk | ||
return false; | ||
} | ||
// try to find editor window | ||
HWND hwnd = FindWindow("VWINDOW", NULL); | ||
if (hwnd != NULL) { | ||
// send it a message to tell it the test framework is here | ||
PostMessage(hwnd, WM_USER + 1, 0, 0); | ||
} | ||
return true; | ||
} | ||
|
||
bool EditorPipe::connect() | ||
{ | ||
// create a global pipe | ||
if (!ConnectNamedPipe(hPipe, NULL)) { | ||
int err = GetLastError(); | ||
if (err != ERROR_PIPE_CONNECTED && err != ERROR_PIPE_LISTENING) { | ||
return false; | ||
} | ||
} | ||
m_serialConnected = true; | ||
return true; | ||
} | ||
|
||
int32_t EditorPipe::available() | ||
{ | ||
DWORD amount = 0; | ||
if (!PeekNamedPipe(hPipe, 0, 0, 0, &amount, 0)) { | ||
return 0; | ||
} | ||
return (int32_t)amount; | ||
} | ||
|
||
size_t EditorPipe::read(char *buf, size_t amt) | ||
{ | ||
DWORD total = 0; | ||
DWORD numRead = 0; | ||
do { | ||
if (!ReadFile(hPipe, buf + total, amt - total, &numRead, NULL)) { | ||
int err = GetLastError(); | ||
if (err == ERROR_PIPE_NOT_CONNECTED) { | ||
printf("Fail\n"); | ||
} | ||
break; | ||
} | ||
total += numRead; | ||
} while (total < amt); | ||
return total; | ||
} | ||
|
||
uint32_t EditorPipe::write(const uint8_t *buf, size_t len) | ||
{ | ||
DWORD total = 0; | ||
DWORD written = 0; | ||
do { | ||
if (!WriteFile(hPipe, buf + total, len - total, &written, NULL)) { | ||
break; | ||
} | ||
total += written; | ||
} while (total < len); | ||
return total; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include <windows.h> | ||
#include <inttypes.h> | ||
|
||
// This is a named pipe to the editor so that the editor | ||
// can connect with the test framework seamlessly | ||
|
||
class EditorPipe | ||
{ | ||
public: | ||
static bool init(); | ||
static bool connect(); | ||
static int32_t available(); | ||
static size_t read(char *buf, size_t amt); | ||
static uint32_t write(const uint8_t *buf, size_t len); | ||
|
||
static bool isConnected() { return m_serialConnected; } | ||
|
||
private: | ||
static HANDLE hPipe; | ||
static bool m_serialConnected; | ||
}; |
15 changes: 0 additions & 15 deletions
15
VortexTestingFramework/EngineDependencies/Adafruit_Dotstar.h
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.