mojo/public/tools/mojom/mojom/generate/pack_unittest.py
def testMinVersion(self):
    """Tests that |min_version| is properly set for packed fields."""
    struct = mojom.Struct('test')
    struct.AddField('field_2', mojom.BOOL, 2)
    struct.AddField('field_0', mojom.INT32, 0)
    struct.AddField('field_1', mojom.INT64, 1)
    ps = pack.PackedStruct(struct)

    self.assertEqual('field_0', ps.packed_fields[0].field.mojom_name)
    self.assertEqual('field_2', ps.packed_fields[1].field.mojom_name)
    self.assertEqual('field_1', ps.packed_fields[2].field.mojom_name)

    self.assertEqual(0, ps.packed_fields[0].min_version)
    self.assertEqual(0, ps.packed_fields[1].min_version)
    self.assertEqual(0, ps.packed_fields[2].min_version)

    struct.fields[0].attributes = {'MinVersion': 1}
    ps = pack.PackedStruct(struct)

    self.assertEqual(0, ps.packed_fields[0].min_version)
    self.assertEqual(1, ps.packed_fields[1].min_version)
    self.assertEqual(0, ps.packed_fields[2].min_version)
Tests that |min_version| is properly set for packed fields.
Tests that |min_version| is properly set for packed fields.
Tests that |min_version| is properly set for packed fields .
def testMinVersion(self):
    struct = mojom.Struct('test')
    struct.AddField('field_2', mojom.BOOL, 2)
    struct.AddField('field_0', mojom.INT32, 0)
    struct.AddField('field_1', mojom.INT64, 1)
    ps = pack.PackedStruct(struct)
    self.assertEqual('field_0', ps.packed_fields[0].field.mojom_name)
    self.assertEqual('field_2', ps.packed_fields[1].field.mojom_name)
    self.assertEqual('field_1', ps.packed_fields[2].field.mojom_name)
    self.assertEqual(0, ps.packed_fields[0].min_version)
    self.assertEqual(0, ps.packed_fields[1].min_version)
    self.assertEqual(0, ps.packed_fields[2].min_version)
    struct.fields[0].attributes = {'MinVersion': 1}
    ps = pack.PackedStruct(struct)
    self.assertEqual(0, ps.packed_fields[0].min_version)
    self.assertEqual(1, ps.packed_fields[1].min_version)
    self.assertEqual(0, ps.packed_fields[2].min_version)
def testMinVersion ( self ) : struct = mojom . Struct ( 'test' ) struct . AddField ( 'field_2' , mojom . BOOL , 2 ) struct . AddField ( 'field_0' , mojom . INT32 , 0 ) struct . AddField ( 'field_1' , mojom . INT64 , 1 ) ps = pack . PackedStruct ( struct ) self . assertEqual ( 'field_0' , ps . packed_fields [ 0 ] . field . mojom_name ) self . assertEqual ( 'field_2' , ps . packed_fields [ 1 ] . field . mojom_name ) self . assertEqual ( 'field_1' , ps . packed_fields [ 2 ] . field . mojom_name ) self . assertEqual ( 0 , ps . packed_fields [ 0 ] . min_version ) self . assertEqual ( 0 , ps . packed_fields [ 1 ] . min_version ) self . assertEqual ( 0 , ps . packed_fields [ 2 ] . min_version ) struct . fields [ 0 ] . attributes = { 'MinVersion' : 1 } ps = pack . PackedStruct ( struct ) self . assertEqual ( 0 , ps . packed_fields [ 0 ] . min_version ) self . assertEqual ( 1 , ps . packed_fields [ 1 ] . min_version ) self . assertEqual ( 0 , ps . packed_fields [ 2 ] . min_version )
Tests that |min_version| is properly set for packed fields.
Tests that |min_version| is properly set for packed fields .
"""Tests that |min_version| is properly set for packed fields."""
self