add test cases about when withinWindow is false