Skip to content

Commit

Permalink
Fix Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Jun 17, 2024
1 parent 840ba03 commit 2e890f5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
40 changes: 39 additions & 1 deletion docs/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This module contains various helper namespaces and objects for working with the
- [Environment](#environment)
- [Process](#process)
- [ProcessExitedEventArgs](#processexitedeventargs)
- [SuspendInhibitor](#suspendinhibitor)

## Environment
Description: Helper functions for working with the system shell environment.
Expand Down Expand Up @@ -133,4 +134,41 @@ Path: `Nickvision::System::ProcessExitedEventArgs`
ProcessExitedEventArgs(int exitCode, const std::string& output)
```
- Constructs a ProcessExitedEventArgs.
- Accepts: The exit code of the process, exitCode, and the console output of the process, output.
- Accepts: The exit code of the process, exitCode, and the console output of the process, output.
## SuspendInhibitor
Description: An object to prevent the system from suspending.
Interface: [suspendinhibitor.h](/include/system/suspendinhibitor.h)
Type: `class`
Path: `Nickvision::System::SuspendInhibitor`
### Member Variables
- ```cpp
bool IsInhibiting: get
```
- Whether or not the system is being inhibited from suspending.

### Methods
- ```cpp
SuspendInhibitor()
```
- Constructs a SuspendInhibitor.
- Note: This will not inhibit the system from suspending until the inhibit() function is called.
- ```cpp
~SuspendInhibitor()
```
- Destructs a SuspendInhibitor.
- Note: If the system is being inhibited, it will uninhibit.
- ```cpp
bool inhibit()
```
- Returns: True if inhibiting system suspend.
- Returns: False if error.
- ```cpp
bool uninhibit()
```
- Returns: True if not inhibiting system suspend.
- Returns: False if error.
12 changes: 12 additions & 0 deletions tests/systemtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,24 @@ TEST_F(SystemTest, Exec)

TEST_F(SystemTest, InhibitSuspend)
{
#ifdef __linux__
if(!Environment::getVariable("GITHUB_ACTIONS").empty())
{
GTEST_SKIP();
}
#endif
ASSERT_TRUE(SystemTest::m_inhibitor->inhibit());
ASSERT_TRUE(SystemTest::m_inhibitor->isInhibiting());
}

TEST_F(SystemTest, UninhibitSuspend)
{
#ifdef __linux__
if(!Environment::getVariable("GITHUB_ACTIONS").empty())
{
GTEST_SKIP();
}
#endif
ASSERT_TRUE(SystemTest::m_inhibitor->uninhibit());
ASSERT_FALSE(SystemTest::m_inhibitor->isInhibiting());
}

0 comments on commit 2e890f5

Please sign in to comment.