-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
148 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const rhino3dm = require('rhino3dm') | ||
|
||
let rhino | ||
beforeEach( async() => { | ||
rhino = await rhino3dm() | ||
}) | ||
//TODO | ||
// Skipping for now. | ||
test.skip('DeleteBitmap', async () => { | ||
|
||
const file3dm = new rhino.File3dm() | ||
file3dm.applicationName = 'rhino3dm.js' | ||
file3dm.applicationDetails = 'rhino3dm-tests-bitmapTable-deleteBitmap' | ||
file3dm.applicationUrl = 'https://rhino3d.com' | ||
|
||
const bm1 = new rhino.Bitmap() | ||
const bm2 = new rhino.Bitmap() | ||
|
||
// .bitmaps().add() is void | ||
model.bitmaps().add(bm1) | ||
model.bitmaps().add(bm2) | ||
|
||
const qtyBitmaps1 = model.bitmaps().count | ||
|
||
const id1 = model.bitmaps().get(0).id | ||
|
||
model.bitmaps().delete(id1) | ||
|
||
const qtyBitmaps2 = model.bitmaps().count | ||
|
||
expect(qtyDims1 === 2 && qtyDims2 === 1).toBe(true) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const rhino3dm = require('rhino3dm') | ||
|
||
let rhino | ||
beforeEach( async() => { | ||
rhino = await rhino3dm() | ||
}) | ||
//TODO | ||
|
||
test('DeleteMaterial', async () => { | ||
|
||
const file3dm = new rhino.File3dm() | ||
file3dm.applicationName = 'rhino3dm.js' | ||
file3dm.applicationDetails = 'rhino3dm-tests-materialTable-deleteMaterial' | ||
file3dm.applicationUrl = 'https://rhino3d.com' | ||
|
||
const material1 = new rhino.Material() | ||
material1.toPhysicallyBased() | ||
material1.physicallyBased().baseColor = { r: 1, g: 0, b: 0, a: 0 } | ||
material1.physicallyBased().metallic = 0.7 | ||
material1.physicallyBased().roughness = 0.5 | ||
|
||
const material2 = new rhino.Material() | ||
material2.toPhysicallyBased() | ||
material2.physicallyBased().baseColor = { r: 1, g: 0, b: 0, a: 0 } | ||
material2.physicallyBased().metallic = 0.7 | ||
material2.physicallyBased().roughness = 0.5 | ||
|
||
const index1 = model.materials().add(material1) | ||
const index2 = model.materials().add(material2) | ||
|
||
const qtyMaterials1 = model.materials().count | ||
|
||
const id1 = model.materials().get(index1).id | ||
|
||
model.materials().delete(id1) | ||
|
||
const qtyMaterials2 = model.materials().count | ||
|
||
expect(qtyMaterials1 === 2 && qtyMaterials2 === 1).toBe(true) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import rhino3dm | ||
import unittest | ||
|
||
#objective: to test creating file with bitmaps | ||
@unittest.skip("Can't seem to add to the bitmap table for now.") | ||
class TestFile3dmBitmapTable(unittest.TestCase): | ||
|
||
def test_deleteBitmap(self): | ||
file3dm = rhino3dm.File3dm() | ||
file3dm.ApplicationName = 'python' | ||
file3dm.ApplicationDetails = 'rhino3dm-tests-deleteBitmap' | ||
file3dm.ApplicationUrl = 'https://rhino3d.com' | ||
|
||
#create bitmaps | ||
bm1 = rhino3dm.Bitmap() | ||
bm2 = rhino3dm.Bitmap() | ||
|
||
file3dm.Bitmaps.Add(bm1) | ||
file3dm.Bitmaps.Add(bm2) | ||
|
||
qtyBitmaps1 = len(file3dm.Bitmaps) | ||
|
||
print(qtyBitmaps1) | ||
|
||
id1 = file3dm.Bitmaps[0].Id | ||
|
||
file3dm.Bitmaps.Delete(id1) | ||
|
||
qtyBitmaps2 = len(file3dm.Bitmaps) | ||
|
||
self.assertTrue(qtyBitmaps1 == 2 and qtyBitmaps2 == 1) | ||
|
||
if __name__ == '__main__': | ||
print("running tests") | ||
unittest.main() | ||
print("tests complete") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import rhino3dm | ||
import unittest | ||
|
||
#objective: to test creating file with bitmaps | ||
class TestFile3dmMaterialTable(unittest.TestCase): | ||
|
||
def test_deleteMaterial(self): | ||
file3dm = rhino3dm.File3dm() | ||
file3dm.ApplicationName = 'python' | ||
file3dm.ApplicationDetails = 'rhino3dm-tests-deleteMaterial' | ||
file3dm.ApplicationUrl = 'https://rhino3d.com' | ||
|
||
#create materials | ||
mat1 = rhino3dm.Material() | ||
mat2 = rhino3dm.Material() | ||
|
||
index1 = file3dm.Materials.Add(mat1) | ||
index2 = file3dm.Materials.Add(mat2) | ||
|
||
qtyMaterials1 = len(file3dm.Materials) | ||
|
||
id1 = file3dm.Materials[index1].Id | ||
|
||
file3dm.Materials.Delete(id1) | ||
|
||
qtyMaterials2 = len(file3dm.Materials) | ||
|
||
self.assertTrue(qtyMaterials1 == 2 and qtyMaterials2 == 1) | ||
|
||
if __name__ == '__main__': | ||
print("running tests") | ||
unittest.main() | ||
print("tests complete") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters