mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
UtilsTest.cs
This commit is contained in:
parent
7a2fc78105
commit
3b9f6592ef
117
Facepunch.Steamworks.Test/Client/UtilsTest.cs
Normal file
117
Facepunch.Steamworks.Test/Client/UtilsTest.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem( "steam_api64.dll" )]
|
||||
public class UtilsTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void SecondsSinceAppActive()
|
||||
{
|
||||
var time = Utils.SecondsSinceAppActive;
|
||||
Console.WriteLine( $"{time}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SecondsSinceComputerActive()
|
||||
{
|
||||
var time = Utils.SecondsSinceComputerActive;
|
||||
Console.WriteLine( $"{time}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ConnectedUniverse()
|
||||
{
|
||||
var u = Utils.ConnectedUniverse;
|
||||
Console.WriteLine( $"{u}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SteamServerTime()
|
||||
{
|
||||
var time = Utils.SteamServerTime;
|
||||
Console.WriteLine( $"{time}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IpCountry()
|
||||
{
|
||||
var cnt = Utils.IpCountry;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UsingBatteryPower()
|
||||
{
|
||||
var cnt = Utils.UsingBatteryPower;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CurrentBatteryPower()
|
||||
{
|
||||
var cnt = Utils.CurrentBatteryPower;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AppId()
|
||||
{
|
||||
var cnt = Utils.AppId;
|
||||
|
||||
Assert.IsTrue( cnt.Value > 0 );
|
||||
|
||||
Console.WriteLine( $"{cnt.Value}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOverlayEnabled()
|
||||
{
|
||||
var cnt = Utils.IsOverlayEnabled;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task CheckFileSignature()
|
||||
{
|
||||
var sig = await Utils.CheckFileSignature( "hl2.exe" );
|
||||
Console.WriteLine( $"{sig}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SteamUILanguage()
|
||||
{
|
||||
var cnt = Utils.SteamUILanguage;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsSteamRunningInVR()
|
||||
{
|
||||
var cnt = Utils.IsSteamRunningInVR;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsSteamInBigPictureMode()
|
||||
{
|
||||
var cnt = Utils.IsSteamInBigPictureMode;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void VrHeadsetStreaming()
|
||||
{
|
||||
var cnt = Utils.VrHeadsetStreaming;
|
||||
Console.WriteLine( $"{cnt}" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -89,6 +89,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Client\AchievementsTest.cs" />
|
||||
<Compile Include="Client\UtilsTest.cs" />
|
||||
<Compile Include="Client\ClientTest.cs" />
|
||||
<Compile Include="Client\LobbyTest.cs" />
|
||||
<Compile Include="Client\RichPresenceTest.cs" />
|
||||
|
@ -53,9 +53,14 @@ internal static void InstallEvents()
|
||||
/// </summary>
|
||||
public static event Action<bool> OnGamepadTextInputDismissed;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of seconds since the application was active
|
||||
/// </summary>
|
||||
public static uint SecondsSinceAppActive => steamutils.GetSecondsSinceAppActive();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of seconds since the user last moved the mouse etc
|
||||
/// </summary>
|
||||
public static uint SecondsSinceComputerActive => steamutils.GetSecondsSinceComputerActive();
|
||||
|
||||
// the universe this client is connecting to
|
||||
@ -104,7 +109,7 @@ public static byte[] GetImageRGBA( int image )
|
||||
/// <summary>
|
||||
/// Returns true if we're using a battery (ie, a laptop not plugged in)
|
||||
/// </summary>
|
||||
public static bool UsingBatteryPower => steamutils.GetCurrentBatteryPower() == 255;
|
||||
public static bool UsingBatteryPower => steamutils.GetCurrentBatteryPower() != 255;
|
||||
|
||||
/// <summary>
|
||||
/// Returns battery power [0-1]
|
||||
@ -134,8 +139,8 @@ public static NotificationPosition OverlayNotificationPosition
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to
|
||||
/// start & hook the game process, so this function will initially return false while the overlay is loading.
|
||||
/// Returns true if the overlay is running and the user can access it. The overlay process could take a few seconds to
|
||||
/// start and hook the game process, so this function will initially return false while the overlay is loading.
|
||||
/// </summary>
|
||||
public static bool IsOverlayEnabled => steamutils.IsOverlayEnabled();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user