public void ReadWriteArray_NotInitialized_ThrowsInvalidOperationException() { var wrapper = new SubBuffer(true); Assert.Throws <InvalidOperationException>(() => wrapper.ReadArray(0, new int[0], 0, 0)); Assert.Throws <InvalidOperationException>(() => wrapper.WriteArray(0, new int[0], 0, 0)); }
public void ReadWriteArray_NegativeCount_ThrowsArgumentOutOfRangeException() { var wrapper = new SubBuffer(true); AssertExtensions.Throws <ArgumentOutOfRangeException>("count", () => wrapper.ReadArray(0, new int[0], 0, -1)); AssertExtensions.Throws <ArgumentOutOfRangeException>("count", () => wrapper.WriteArray(0, new int[0], 0, -1)); }
public void Initialize_NumBytesTimesSizeOfEachElement_ThrowsArgumentOutOfRangeExceptionIfNot64Bit() { var buffer = new SubBuffer(true); AssertExtensions.ThrowsIf <ArgumentOutOfRangeException>(!Environment.Is64BitProcess, () => buffer.Initialize(uint.MaxValue, uint.MaxValue)); AssertExtensions.ThrowsIf <ArgumentOutOfRangeException>(!Environment.Is64BitProcess, () => buffer.Initialize <int>(uint.MaxValue)); }
public void ReadArray_NullArray_ThrowsArgumentNullException() { var wrapper = new SubBuffer(true); AssertExtensions.Throws <ArgumentNullException>("array", () => wrapper.ReadArray <int>(0, null, 0, 0)); AssertExtensions.Throws <ArgumentNullException>("array", () => wrapper.WriteArray <int>(0, null, 0, 0)); }
public unsafe void AcquirePointer_NotInitialized_ThrowsInvalidOperationException() { var wrapper = new SubBuffer(true); byte *pointer = null; Assert.Throws <InvalidOperationException>(() => wrapper.AcquirePointer(ref pointer)); }
public void Initialize_NumBytesTimesSizeOfEachElement_ThrowsOverflowException() { var buffer = new SubBuffer(true); Assert.Throws <OverflowException>(() => buffer.Initialize(uint.MaxValue, uint.MaxValue)); Assert.Throws <OverflowException>(() => buffer.Initialize <int>(uint.MaxValue)); }
public void ReadWrite_NotInitialized_ThrowsInvalidOperationException() { var wrapper = new SubBuffer(true); Assert.Throws <InvalidOperationException>(() => wrapper.Read <int>(0)); Assert.Throws <InvalidOperationException>(() => wrapper.Write(0, 2)); }
public void ReadWriteArray_NegativeCount_ThrowsArgumentOutOfRangeException(int arrayLength, int index, int count) { var wrapper = new SubBuffer(true); AssertExtensions.Throws <ArgumentException>(null, () => wrapper.ReadArray(0, new int[arrayLength], index, count)); AssertExtensions.Throws <ArgumentException>(null, () => wrapper.WriteArray(0, new int[arrayLength], index, count)); }
public PhysicalPartition(PartitionDescriptor descriptor, IBuffer buffer, uint sectorSize) { _partitionNumber = descriptor.PartitionNumber; _parentBuffer = buffer; Content = new SubBuffer(_parentBuffer, descriptor.PartitionStartingLocation * (long)sectorSize, descriptor.PartitionLength * (long)sectorSize); _descriptor = descriptor; }
public void ReadWrite_NotEnoughSpaceInBuffer_ThrowsArgumentException(ulong byteOffset) { var buffer = new SubBuffer(true); buffer.Initialize(4); Assert.Throws <ArgumentException>(null, () => buffer.Read <int>(4)); Assert.Throws <ArgumentException>(null, () => buffer.Write <int>(4, 2)); }
public void ReadWriteSpan_EmptySpan_Passes() { var buffer = new SubBuffer(true); buffer.Initialize(0); buffer.ReadSpan <int>(0, Span <int> .Empty); buffer.WriteSpan <int>(0, ReadOnlySpan <int> .Empty); }
private void CreateProgressBarSubBuffer() { progressBarSubBuffer = new SubBuffer(); progressBarSubBuffer.SetSize(3, ColumnCount); progressBarSubBuffer.Fixed = true; progressBarSubBuffer.PositionRow = RowCount - progressBarSubBuffer.RowCount; AddSubBuffer(progressBarSubBuffer); var separator = new string('-', progressBarSubBuffer.ColumnCount); progressBarSubBuffer.Buffer[0].ArrayCopyFrom(separator.ToCharArray(), 0, 0); }
public unsafe void AcquirePointer_Disposed_ThrowsObjectDisposedException() { var buffer = new SubBuffer(true); buffer.Initialize(4); buffer.Dispose(); byte *pointer = (byte *)12345; Assert.Throws <ObjectDisposedException>(() => buffer.AcquirePointer(ref pointer)); Assert.True(pointer is null); }
private void CreateProgressBarSubBuffer() { progressBarSubBuffer = new SubBuffer(); progressBarSubBuffer.SetSize(3, ColumnCount); progressBarSubBuffer.Fixed = true; progressBarSubBuffer.PositionRow = RowCount - progressBarSubBuffer.RowCount; AddSubBuffer(progressBarSubBuffer); var separator = new string('-', progressBarSubBuffer.ColumnCount); separator.ToCharArray().CopyTo(progressBarSubBuffer.Buffer[0], 0); }
private SubBuffer <T> BuildInternal(MemoryFlags flags) { var handle = GCHandle.Alloc(_region, GCHandleType.Pinned); var id = Api.BufferApi.clCreateSubBuffer(_parent.Id, flags, BufferCreateType.Region, handle.AddrOfPinnedObject(), out var error); handle.Free(); error.ThrowOnError(); var subBuffer = new SubBuffer <T>(Api, _parent, id); MemoryObjectCreatedCallback(subBuffer); return(subBuffer); }
public void ReleasePointer_NotInitialized_ThrowsInvalidOperationException() { var wrapper = new SubBuffer(true); Assert.Throws <InvalidOperationException>(() => wrapper.ReleasePointer()); }
public void RemoveSubBuffer(SubBuffer subBuffer) { throw new NotImplementedException(); }
public void Initialize_InvalidNumBytes_ThrowsArgumentOutOfRangeException() { var buffer = new SubBuffer(true); AssertExtensions.Throws <ArgumentOutOfRangeException>("numBytes", () => buffer.Initialize(ulong.MaxValue)); }
public void Ctor_Bool(bool ownsHandle) { var buffer = new SubBuffer(ownsHandle); Assert.True(buffer.IsInvalid); }
/// <summary> /// Main 2D drawing method for a UWKView, draws the view at the given X, Y coords with width and height dimensions /// </summary> public void DrawGUI(int x, int y, int width, int height) { if (!valid || !Visible) { return; } if (width <= 0) { width = Width; height = Height; } #if !UNITY_EDITOR && UNITY_IPHONE MobileRect = new Rect(x, y, width, height); return; #endif int bw = TSet.BackBuffer.width; int bh = TSet.BackBuffer.height; Rect br = new Rect(x, y, bw, bh); GUI.DrawTexture(br, TSet.BackBuffer); if (!SmartRects) { return; } int activeMip0 = 0; int activeMip1 = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { SubBuffer s = TSet.SubBuffers [i, j]; if (!s.Active) { continue; } Rect r = new Rect(x + s.X, y + s.Y, s.Width, s.Height); GUI.DrawTexture(r, s.Texture); if (i == 0) { activeMip0++; } else { activeMip1++; } } } if (UWKCore.imeEnabled) { DrawTextIME(x, y); } //Debug.Log("Active SubTex Mip0: " + activeMip0 + ", Active SubTrex Mip1: " + activeMip1); }
public void ByteLength_GetNotInitialized_ThrowsInvalidOperationException() { var wrapper = new SubBuffer(true); Assert.Throws <InvalidOperationException>(() => wrapper.ByteLength); }