# Copyright:: Copyright 2012 Trimble Navigation Ltd.
# License:: Apache License version 2.0
# Original Author:: Scott Lininger 
#
# Tests the SketchUp Ruby API ConstructionPoint object.
#
# This file was originally generated by ourdoc.rb, an internal tool we developed
# specifically for outputting support files (documentation, unit tests, etc.)
# from the standard, doxygen-style c++ comments that are embedded into the
# Ruby implementation files. You can find ourdoc.rb alongside these
# implementation files at:
#
# googleclient/sketchup/source/sketchup/ruby
#

require 'test/unit'

# TC_ConstructionPoint contains unit tests for the ConstructionPoint class.
#
# API Object::       ConstructionPoint
# C++ File::         rconstructionpoint.cpp
# Parent Class::     Drawingelement
# Version::          SketchUp 6.0
#
# A construction point represents a point in the model that can be used to aid
# in other modeling operations. For example, you may put a construction point
# at the center of a circle to make it easier to locate that point for
# performing other operations.
#
#
class TC_ConstructionPoint < Test::Unit::TestCase

  # Setup for test cases, if required.
  #
  def setup
    def UI::messagebox(params)
      puts 'TESTUP OVERRIDE: UI::messagebox > ' + params.to_s
    end

    entities_to_erase = []
    for entity in Sketchup.active_model.entities
      entities_to_erase.push entity
    end

    for entity in entities_to_erase
      if entity.valid?
        entity.erase!
      end
    end
  end

  # ----------------------------------------------------------------------------
  # @par Ruby Method:    ConstructionPoint.position
  # @file                rconstructionpoint.cpp
  #
  # The position method is used to retrieve a Point3d used to create a
  # construction point.
  #
  #
  # Args:
  #
  # Returns:
  # - point: the Point3d object used to create the
  # ConstructionPoint
  #

  # Test the example code that we have in the API documentation.
  def test_position_api_example
    assert_nothing_raised do
     model = Sketchup.active_model
     entities = model.active_entities
     point1 = Geom::Point3d.new(10,0,0)
     constpoint = entities.add_cpoint point1
     # Returns 10,0,0
     position = constpoint.position
    end
  end

  # Test edgecases for values passed to this method.
  #def test_position_edgecases
  #  raise('AUTOGENERATED STUB. Do manual review, then delete this warning.')
  #  assert_equal('expected', 'result',
  #               'Failed in test_position_edgecases' )
  #end

  # Test what happens when bad arguments are passed (nil, too few, etc.)
  #def test_position_bad_params
  #  raise('AUTOGENERATED STUB. Do manual review, then delete this warning.')
  #  assert_raise RuntimeError do
  #    # bad arguments here that should cause errors
  #  end
  #end

end
