Windowing System task issue, can I just not read?

This may be something on my end that I’m completely missing so fully understand this may be user error.

I’m stuck on Task 5, Test 13 which is to add a move method to the ProgramWindow class. Being totally honest I don’t think I even understand the error (see screenshot)

I understand that I need to resize the window, but according to my logs, the screensize is big enough to encompass the window.

Again, this is probably something that I’m just not understanding or missing but I’m at a bit of a loss with this one.

I don’t know the exercise, but the error is saying it expected 700 but got 750 instead. But looking at the code, I’m not sure why that’s the case as it seems to be positioning it at 750

I’m fully expecting it’s something I’ve done on my end, but as all the other tests are passing up to this point… I’m a bit lost haha.

Are you remembering to take into account the screen size when changing the window position? (The test name suggests you may not be.)

I think I may just be tired but I honestly have no idea at this point, I thought I was but I’m clearly missing something.

Here’s my reverted code (it was a mess of half guesses) that all pass up until this issue, so theres currently no code to handle if the window is bigger than the screen, but as I say, everything I’ve tried to resolve that issue hasn’t changed the result.

If you can point out to me where I’m going wrong and if you can ELI5 it for me, you will be my hero.

I have a hard time copy/pasting from images, or even reading them. Would you mind sharing your code and the test details as text in a codeblock?

Oh my bad mate, apologies!

export class ProgramWindow {
  constructor() { 
    this.screenSize = new Size(800, 600)
    this.size = new Size()
    this.position = new Position()
  }
  
  resize(newSize) {
    this.size.width = newSize.width <= 0 ? 1 : newSize.width 
    this.size.height = newSize.height <= 0  ? 1 : newSize.height 
  }

  move(position) {
    console.log('In Move: ', position, this.screenSize, this.size)
    this.position.x = position.x < 0 ? 0 : position.x
    this.position.y = position.y < 0 ? 0 : position.y
  }
}

When moving the window, you need to take this.size (or this.screenSize) into consideration; the window cannot be moved off-screen.

Yea thats currently where I’m stuck out, I’ve just removed all the code where I’ve been trying things with screenSize or size.

Cheers anyway mate, I’ll get it eventually haha!

  1. Why is there two sizes?
  2. When moving, what prevents the window from moving off the screen?