Commit c6acafe4 authored by 16이상민's avatar 16이상민

Add test for 'SourceBuffer' class

parent 38c2e903
using UnityEngine;
using UnityEditor;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using Windows.Kinect;
using System.Runtime.InteropServices;
public class SourceBufferTests
{
const int DepthWidth = 512,
DepthHeight = 424,
ColorWidth = 1920,
ColorHeight = 1080;
[Test]
public void SourceBufferTestsSimplePasses()
{
// Use the Assert class to test conditions.
var sensor = KinectSensor.GetDefault();
Assert.IsNotNull(sensor, "No ready kinect found.");
sensor.Open();
Assert.IsTrue(sensor.IsOpen, "Kinect sensor has problem.");
var coordinateMapper = sensor.CoordinateMapper;
using (var sourceFrameReader = sensor.OpenMultiSourceFrameReader(
FrameSourceTypes.Color |
FrameSourceTypes.Depth |
FrameSourceTypes.BodyIndex |
FrameSourceTypes.Body))
{
while (sourceFrameReader == null) ;
var sourceFrame = sourceFrameReader.AcquireLatestFrame();
SourceBuffer.UpdateBuffers(sourceFrame);
ColorBufferTest(sourceFrame);
}
sensor.Close();
}
private void ColorBufferTest(MultiSourceFrame sourceFrame)
{
var colorBuffer = new byte[ColorWidth * ColorHeight * 4];
using (var colorFrame = sourceFrame.ColorFrameReference.AcquireFrame())
if (colorFrame != null)
{
var ColorData = GCHandle.Alloc(colorBuffer, GCHandleType.Pinned);
colorFrame.CopyConvertedFrameDataToIntPtr(ColorData.AddrOfPinnedObject(), (uint)colorBuffer.Length, ColorImageFormat.Rgba);
ColorData.Free();
}
Assert.AreEqual(colorBuffer, SourceBuffer.ColorBuffer, "ColorBufferTest failed.");
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator SourceBufferTestsWithEnumeratorPasses()
{
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
}
}
fileFormatVersion: 2
guid: d95c62ab1cbf8da49aefd3f697b19e36
folderAsset: yes
timeCreated: 1515051671
guid: 425707c9be041bf4f8fb030d720ab21c
timeCreated: 1515179025
licenseType: Free
DefaultImporter:
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -138,7 +138,7 @@ public class CoordinateMapperManager : MonoBehaviour
}
}
static class SourceBuffer
public static class SourceBuffer
{
private const int DepthWidth = 512;
private const int DepthHeight = 424;
......
......@@ -3,9 +3,10 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 14
productGUID: 7e63f6c84724de64db0af5769d5bf47a
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
defaultScreenOrientation: 4
targetDevice: 2
useOnDemandResources: 0
......@@ -14,7 +15,7 @@ PlayerSettings:
productName: ButtonPusher
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
......@@ -38,8 +39,6 @@ PlayerSettings:
width: 1
height: 1
m_SplashScreenLogos: []
m_SplashScreenBackgroundLandscape: {fileID: 0}
m_SplashScreenBackgroundPortrait: {fileID: 0}
m_VirtualRealitySplashScreen: {fileID: 0}
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024
......@@ -49,7 +48,6 @@ PlayerSettings:
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
m_MTRendering: 1
m_MobileMTRendering: 0
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
......@@ -63,13 +61,19 @@ PlayerSettings:
allowedAutorotateToLandscapeLeft: 1
useOSAutorotation: 1
use32BitDisplayBuffer: 1
preserveFramebufferAlpha: 0
disableDepthAndStencilBuffers: 0
androidBlitType: 0
defaultIsFullScreen: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 0
captureSingleScreen: 0
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
deferSystemGesturesMode: 0
hideHomeButton: 0
submitAnalytics: 1
usePlayerLog: 1
bakeCollisionMeshes: 0
......@@ -88,19 +92,22 @@ PlayerSettings:
allowFullscreenSwitch: 1
graphicsJobMode: 0
macFullscreenMode: 2
d3d9FullscreenMode: 1
d3d11FullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
xboxEnablePIXSampling: 0
metalFramebufferOnly: 0
n3dsDisableStereoscopicView: 0
n3dsEnableSharedListOpt: 1
n3dsEnableVSync: 0
ignoreAlphaClear: 0
xboxOneResolution: 0
xboxOneSResolution: 0
xboxOneXResolution: 3
xboxOneMonoLoggingLevel: 0
xboxOneLoggingLevel: 1
xboxOneDisableEsram: 0
xboxOnePresentImmediateThreshold: 0
videoMemoryForVertexBuffers: 0
psp2PowerMode: 0
psp2AcquireBGM: 1
......@@ -122,6 +129,7 @@ PlayerSettings:
bundleVersion: 1.0
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 0
xboxOneEnable7thCore: 0
......@@ -132,10 +140,23 @@ PlayerSettings:
daydream:
depthFormat: 0
useSustainedPerformanceMode: 0
enableVideoLayer: 0
useProtectedVideoMemory: 0
minimumSupportedHeadTracking: 0
maximumSupportedHeadTracking: 1
hololens:
depthFormat: 1
depthBufferSharingEnabled: 0
oculus:
sharedDepthBuffer: 0
dashSupport: 0
protectGraphicsMemory: 0
useHDRDisplay: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
buildNumber: {}
AndroidBundleVersionCode: 1
......@@ -156,10 +177,10 @@ PlayerSettings:
serializedVersion: 2
m_Bits: 238
iPhoneSdkVersion: 988
iOSTargetOSVersionString:
iOSTargetOSVersionString: 7.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString:
tvOSTargetOSVersionString: 9.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
......@@ -172,15 +193,22 @@ PlayerSettings:
iPhone47inSplashScreen: {fileID: 0}
iPhone55inPortraitSplashScreen: {fileID: 0}
iPhone55inLandscapeSplashScreen: {fileID: 0}
iPhone58inPortraitSplashScreen: {fileID: 0}
iPhone58inLandscapeSplashScreen: {fileID: 0}
iPadPortraitSplashScreen: {fileID: 0}
iPadHighResPortraitSplashScreen: {fileID: 0}
iPadLandscapeSplashScreen: {fileID: 0}
iPadHighResLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
tvOSSmallIconLayers2x: []
tvOSLargeIconLayers: []
tvOSLargeIconLayers2x: []
tvOSTopShelfImageLayers: []
tvOSTopShelfImageLayers2x: []
tvOSTopShelfImageWideLayers: []
tvOSTopShelfImageWideLayers2x: []
iOSLaunchScreenType: 0
iOSLaunchScreenPortrait: {fileID: 0}
iOSLaunchScreenLandscape: {fileID: 0}
......@@ -198,6 +226,8 @@ PlayerSettings:
iOSLaunchScreeniPadFillPct: 100
iOSLaunchScreeniPadSize: 100
iOSLaunchScreeniPadCustomXibPath:
iOSUseLaunchScreenStoryboard: 0
iOSLaunchScreenCustomStoryboardPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
iOSBackgroundModes: 0
......@@ -209,6 +239,7 @@ PlayerSettings:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
appleEnableAutomaticSigning: 0
clonedFromGUID: 00000000000000000000000000000000
AndroidTargetDevice: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
......@@ -216,7 +247,9 @@ PlayerSettings:
AndroidKeyaliasName:
AndroidTVCompatibility: 1
AndroidIsGame: 1
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
m_AndroidBanners:
- width: 320
height: 180
......@@ -227,10 +260,20 @@ PlayerSettings:
m_BuildTargetBatching: []
m_BuildTargetGraphicsAPIs: []
m_BuildTargetVRSettings: []
m_BuildTargetEnableVuforiaSettings: []
openGLRequireES31: 0
openGLRequireES31AEP: 0
webPlayerTemplate: APPLICATION:Default
m_TemplateCustomTags: {}
mobileMTRendering:
iPhone: 1
tvOS: 1
m_BuildTargetGroupLightmapEncodingQuality:
- m_BuildTarget: Standalone
m_EncodingQuality: 1
- m_BuildTarget: XboxOne
m_EncodingQuality: 1
- m_BuildTarget: PS4
m_EncodingQuality: 1
wiiUTitleID: 0005000011000000
wiiUGroupID: 00010000
wiiUCommonSaveSize: 4096
......@@ -277,6 +320,9 @@ PlayerSettings:
switchTitleNames_9:
switchTitleNames_10:
switchTitleNames_11:
switchTitleNames_12:
switchTitleNames_13:
switchTitleNames_14:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:
......@@ -289,6 +335,9 @@ PlayerSettings:
switchPublisherNames_9:
switchPublisherNames_10:
switchPublisherNames_11:
switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
......@@ -301,6 +350,9 @@ PlayerSettings:
switchIcons_9: {fileID: 0}
switchIcons_10: {fileID: 0}
switchIcons_11: {fileID: 0}
switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
......@@ -313,6 +365,9 @@ PlayerSettings:
switchSmallIcons_9: {fileID: 0}
switchSmallIcons_10: {fileID: 0}
switchSmallIcons_11: {fileID: 0}
switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
......@@ -354,6 +409,8 @@ PlayerSettings:
switchLocalCommunicationIds_7:
switchParentalControl: 0
switchAllowsScreenshot: 1
switchAllowsVideoCapturing: 1
switchAllowsRuntimeAddOnContentInstall: 0
switchDataLossConfirmation: 0
switchSupportedNpadStyles: 3
switchSocketConfigEnabled: 0
......@@ -364,6 +421,9 @@ PlayerSettings:
switchUdpSendBufferSize: 9
switchUdpReceiveBufferSize: 42
switchSocketBufferEfficiency: 4
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
......@@ -382,6 +442,8 @@ PlayerSettings:
ps4PronunciationSIGPath:
ps4BackgroundImagePath:
ps4StartupImagePath:
ps4StartupImagesFolder:
ps4IconImagesFolder:
ps4SaveDataImagePath:
ps4SdkOverride:
ps4BGMPath:
......@@ -401,7 +463,6 @@ PlayerSettings:
ps4GarlicHeapSize: 2048
ps4ProGarlicHeapSize: 2560
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4UseDebugIl2cppLibs: 0
ps4pnSessions: 1
ps4pnPresence: 1
ps4pnFriends: 1
......@@ -476,7 +537,7 @@ PlayerSettings:
psp2UseLibLocation: 0
psp2InfoBarOnStartup: 0
psp2InfoBarColor: 0
psp2UseDebugIl2cppLibs: 0
psp2ScriptOptimizationLevel: 0
psmSplashimage: {fileID: 0}
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
......@@ -498,6 +559,7 @@ PlayerSettings:
scriptingBackend: {}
incrementalIl2cppBuild: {}
additionalIl2CppArgs:
scriptingRuntimeVersion: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
m_MobileRenderingPath: 1
......@@ -546,12 +608,6 @@ PlayerSettings:
n3dsTitle: GameName
n3dsProductCode:
n3dsApplicationId: 0xFF3FF
stvDeviceAddress:
stvProductDescription:
stvProductAuthor:
stvProductAuthorEmail:
stvProductLink:
stvProductCategory: 0
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
......@@ -587,4 +643,5 @@ PlayerSettings:
projectName: ButtonPusher
organizationId: cat-dog
cloudEnabled: 0
enableNewInputSystem: 0
enableNativePlatformBackendsForNewInputSystem: 0
disableOldInputManagerSupport: 0
m_EditorVersion: 2017.1.0f3
m_EditorVersion: 2017.3.0f3
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="2638cd05610744eb" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.9.0.0" newVersion="3.9.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment