Skip to content

Commit

Permalink
set property values
Browse files Browse the repository at this point in the history
  • Loading branch information
mauserzjeh committed May 14, 2024
1 parent 088a6d3 commit 2cb952c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,12 @@ func (p *CastProperty[T]) GetValues() []T {
return p.values
}

// AddValues adds values to the property's values
// SetValues sets the values of the property
func (p *CastProperty[T]) SetValues(values ...T) {
p.values = values
}

// AddValues adds values to the property
func (p *CastProperty[T]) AddValues(values ...T) {
p.values = append(p.values, values...)
}
Expand Down
6 changes: 6 additions & 0 deletions cast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ func TestCastFile(t *testing.T) {
assertEqual(t, len(p.GetValues()), 1)
assertEqual(t, p.GetValues()[0], "foo")

p.SetValues("bar", "baz")
values := p.GetValues()
assertEqual(t, len(values), 2)
assertEqual(t, values[0], "bar")
assertEqual(t, values[1], "baz")

prop2, err := CreateProperty(mesh, PropNamePosition, PropVector3, Vec3{
X: 1,
Y: 2,
Expand Down

0 comments on commit 2cb952c

Please sign in to comment.