mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-07 01:35:25 +08:00
qt 6.5.1 original
This commit is contained in:
22
tests/auto/corelib/io/qprocess/testSoftExit/CMakeLists.txt
Normal file
22
tests/auto/corelib/io/qprocess/testSoftExit/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## testSoftExit Binary:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_executable(testSoftExit
|
||||
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(testSoftExit CONDITION WIN32
|
||||
SOURCES
|
||||
main_win.cpp
|
||||
LIBRARIES
|
||||
user32
|
||||
)
|
||||
|
||||
qt_internal_extend_target(testSoftExit CONDITION UNIX
|
||||
SOURCES
|
||||
main_unix.cpp
|
||||
)
|
24
tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
Normal file
24
tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
struct sigaction noaction;
|
||||
memset(&noaction, 0, sizeof(noaction));
|
||||
noaction.sa_handler = SIG_IGN;
|
||||
::sigaction(SIGTERM, &noaction, 0);
|
||||
|
||||
printf("Ready\n");
|
||||
fflush(stdout);
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
sleep(1);
|
||||
return 0;
|
||||
}
|
20
tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
Normal file
20
tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Ready\n");
|
||||
fflush(stdout);
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
if (msg.message == WM_CLOSE)
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
return int(msg.wParam);
|
||||
}
|
Reference in New Issue
Block a user