Some tests :
==============================
Test 1
g.fillAll(Colours::red);

Seems normal
==============================
Test2
g.setColour(Colours::red);
g.fillRect(getLocalBounds());

Seems normal
==============================
Test3
Path p;
p.addRectangle(getLocalBounds().toFloat());
g.setColour(Colours::red);
g.fillPath(p);

Not what I expect
==============================
Test4
Path p;
p.addRectangle(getLocalBounds().toFloat().reduced(0.5f));
g.setColour(Colours::red);
g.fillPath(p);

From this it seems that a rectangle in a path is already reduced, so it stacks to 1 pixel difference.
==============================
Test5
Path p;
p.addRectangle(getLocalBounds().toFloat().expanded(0.5f));
g.setColour(Colours::red);
g.fillPath(p);

So if we add 0.5 it display wath I want. At least for the fillPath
==============================
Test6
Path p;
p.addRectangle(getLocalBounds().toFloat().expanded(0.5f));
g.setColour(Colours::red);
g.fillPath(p);
Path p2;
p2.addRectangle(getLocalBounds().toFloat());
g.setColour(Colours::green);
g.strokePath(p2, PathStrokeType(1.0));

This one seems pretty good, but actually if you look at pixel levels there is a dark rectangle. Something I would expect with this formula :
auto bounds = getLocalBounds();
bounds = bounds.removeFromLeft(1);
bounds = bounds.removeFromRight(1);
g.setColour(Colours::black.withAlpha(0.1f));
g.drawRect(bounds);
==============================
Test7
I tried
Path p;
p.addRectangle(getLocalBounds().toFloat().expanded(0.5f));
g.setColour(Colours::red);
g.fillPath(p);
Path p2;
p2.addRectangle(getLocalBounds().toFloat().reduced(0.5f));
g.setColour(Colours::green);
g.strokePath(p2, PathStrokeType(1.0));

This one has the blurred lines for the outline that teach us that for drawing rect it should have the 0.5 offset, wich is seems normal to me.
==============================
Conclusion, it seems that g.drawRect
behaviour is the same as the one using g.strokePath
. It’s consistant, so it’s fine.
Filling a rect from a path should expand it from 0.5f to actually fill the full component which seems strange to me.
But stroking a path does not need the bounds to be expanded wich seems normal, but unfortunately there is artifacts (the dark rectangle that exclude the side of the component)…