mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-04 20:24:42 +08:00
#81 TWIdentity flag properties not set correctly
This commit is contained in:
parent
a11add856d
commit
89a87dea36
@ -49,5 +49,27 @@ namespace NTwain.Tests.Data
|
||||
string badString = new String('a', overLength);
|
||||
target.ProductName = badString;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Setting_and_Unsetting_the_Shared_Flag_Properties_Works()
|
||||
{
|
||||
TWIdentity id = new TWIdentity();
|
||||
|
||||
// these 2 flag properties are store in same int value so needs to test together
|
||||
|
||||
id.DataFunctionalities = DataFunctionalities.App2;
|
||||
id.DataGroup = DataGroups.Audio;
|
||||
Assert.AreEqual(DataFunctionalities.App2, id.DataFunctionalities);
|
||||
Assert.AreEqual(DataGroups.Audio, id.DataGroup);
|
||||
|
||||
// clear needs to be tested
|
||||
id.DataFunctionalities = DataFunctionalities.None;
|
||||
Assert.AreEqual(DataFunctionalities.None, id.DataFunctionalities);
|
||||
Assert.AreEqual(DataGroups.Audio, id.DataGroup, "Cleared incorrectly.");
|
||||
|
||||
id.DataGroup = DataGroups.None;
|
||||
Assert.AreEqual(DataGroups.None, id.DataGroup);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace NTwain.Data
|
||||
Buffer.BlockCopy(part, 0, array, 2, 2);
|
||||
|
||||
var converted = BitConverter.ToUInt32(array, 0);
|
||||
|
||||
|
||||
return new TWOneValue
|
||||
{
|
||||
ItemType = ItemType.Fix32,
|
||||
@ -1685,7 +1685,7 @@ namespace NTwain.Data
|
||||
public DataGroups DataGroup
|
||||
{
|
||||
get { return (DataGroups)(_supportedGroups & 0xffff); }
|
||||
set { _supportedGroups |= (uint)value; }
|
||||
set { _supportedGroups = ((uint)value & 0xffff) | (0xffff0000 & _supportedGroups); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1710,7 +1710,7 @@ namespace NTwain.Data
|
||||
public DataFunctionalities DataFunctionalities
|
||||
{
|
||||
get { return (DataFunctionalities)(_supportedGroups & 0xffff0000); }
|
||||
set { _supportedGroups |= (uint)value; }
|
||||
set { _supportedGroups = ((uint)value & 0xffff0000) | (0x0000ffff & _supportedGroups); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user